web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / White space appearing ...
Power Apps
Suggested Answer

White space appearing at bottom of A5 PDF when using PDF() function in Power Apps

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

 

I am generating a PDF from a Container in Power Apps using the PDF() function with the following settings:

Size: PaperSize.A5

Margin: "0pt"

ExpandContainers: true

 

Here is the code I am using:

 
Set(
varResult,
CreateCardPDF.Run(
User().Email,
{
file: {
contentBytes: PDF(
Container1,
{
Size: PaperSize.A5,
ExpandContainers: true,
Margin: "0pt"
}
),
name: "Card.pdf"
}
}
)
);
 

The issue:

 

Even though I have set the margin to 0pt and adjusted my container and image to fill the entire area (Width = Parent.Width, Height = Parent.Height, ImagePosition = Fill), I still get a white space at the bottom of the generated A5 PDF.

 

It does not look like a margin issue — it seems like the container height does not fully match the A5 page height when rendered as PDF.

 

What I have already tried:

 

Setting all container padding to 0

Using ImagePosition.Fill

Manually setting container size to match A5 ratio

Extending the background image height slightly

 

However, the white space at the bottom still appears.

 

Has anyone experienced this behavior with the PDF() function when using A5 size?

Is there a known rendering limitation or a recommended way to force the container to exactly match the PDF page height?

Categories:
I have the same question (0)
  • Suggested answer
    Sunil Kumar Pashikanti Profile Picture
    762 Moderator on at
     
    This usually isn’t a “margin” issue; it’s a rendering + sizing mismatch between the logical page height that PDF() uses and the actual pixel height of your container after laoyut, rounding, auto-height, and device pixel ratio are applied.
     
    Exact A5 pixel table (96 DPI)
    Orientation Width (px) Height (px)
    Portrait 560 794
    Landscape 794 560
    A5 = 5.83" × 8.27" → 5.83×96 ≈ 560; 8.27×96 ≈ 794.
     
    Temporarily set the printable container’s Fill to a bright color (e.g., yellow). If the white strip disappears (becomes yellow), that confirms it’s the page background peeking through, i.e., height mismatch.
    Turn off AutoHeight on labels and give them explicit heights.
    Remove borders on containers and controls (border adds extra pixels).
    Ensure the Screen doesn’t affect size: don’t bind the printable container’s Height to Parent.Height. Use constants instead.
     
    Follow the below steps:
    Force your printable container to the exact pixel dimensions for A5 in the same orientation that you pass to PDF().
    1) Define constants (on OnStart or right before exporting)
         // Portrait A5 at 96 DPI
         Set(varA5Width, 560);
         Set(varA5Height, 794);
    If you need landscape, swap them: width = 794, height = 560 (and set Orientation: Landscape in PDF()).

    2) Apply to your printable container
         // Container1 exact page size
         Container1.Width  = varA5Width
         Container1.Height = varA5Height
         Container1.PaddingTop = 0
         Container1.PaddingBottom = 0
         Container1.PaddingLeft = 0
         Container1.PaddingRight = 0
         Container1.BorderThickness = 0     // if you had a border
         Container1.Fill = RGBA(255,255,255,1) // soild background, not transparent
     
    Avoid AutoHeight controls in the page; give labels/images fixed heights. AutoHeight + ExpandContainers can push the layout unpredictably and create a tiny overflow that becomes white space.
     
    3) Try this first - Export with ExpandContainers:false 
    In many cases the white bar is caused by ExpandContainers:true letting an internal child auto-grow a hair more than the page height. Fixing the container to exact pixels and turning ExpandContainers off usually removes the gap.
     
    If you must keep ExpandContainers:true
         Keep every child fixed height (no AutoHeight).
         Ensure no nested container has padding/border (those add pixels).
         Ensure Image controls are set to ImagePosition = Fill and given explicit Height = exact px (don’t rely on Fill to compute height).
         Keep everything aligned to integer X/Y/Height/Width (avoid decimal values from formulas like multipliers of ratios).
     
    As a safety net, make the outermost container 1–2 px taller than A5 to absorb any rounding
         ContainerOuter.Width  = 560;
         ContainerOuter.Height = 796; // 2 px buffer
         ContainerInner.Width  = 560;
         ContainerInner.Height = 794;

    Then pass ContainerOuter to PDF(). This hides any fractional push without visually changing your content.
     
    Let us know if it helps!
     
    ✅ If this answer helped resolve your issue, please mark it as Accepted so it can help others with the same problem.
    👍 Feel free to Like the post if you found it useful.
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 105 Most Valuable Professional

#2
Haque Profile Picture

Haque 77

#3
VASANTH KUMAR BALMADI Profile Picture

VASANTH KUMAR BALMADI 70

Last 30 days Overall leaderboard