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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Suggested Answer

PDF Generation

(1) ShareShare
ReportReport
Posted on by 8
Hi, I recently started use the power apps with one project in mind.
 
The app has three screens, in the first you can visualize the items from a sharepoint list, which is the base of the whole project, you're able to change and insert new itens including one image per item.
 
At the second you can visualize a kind of preview of the pdf (that is where the problem starts), the structure is basically:

MainScreen1_1
|-ScreenContainer1_1
|   |-TableNameContainer1_1 (here we have a little "tittle bar" with the "back" btn and the generate btn)
|   |    |-btnGerar_1 (the generate btn)
|   |-BodyContainer1_1
|      |-InfoContainer (the important info is here)
|            |-HeaderRelatorio (shows the user, location and date
|            |-MainInfoRelatorio
|               |-PDFbody_1 (here the data is exibited, its a Vertical Gallery, inside of it we have the labels, with the data and the image)

When the btnGerar_1 is clicked, the app should creat a Pdf with the whole content from the Containers and Gallery, but he is doing a kind of print, it only gets the info that is actually being visualized on the screen
btnGerar_1 has the following code:
 
Set(varPDF; PDF(
    InfoContainer; {
        ExpandContainers: true;
        Orientation: PaperOrientation.Landscape;
        Size: PaperSize.A4;
        Margin: "10pt, 25pt, 10pt, 25pt";
        DPI: 100
    }));;
 
Notify("O PDF foi gerado com sucesso!"; NotificationType.Success);;
 
Office365Outlook.SendEmailV2(
    "email@example.com.br";
    "PDF teste";
    "Segue PDF Rel teste";{Attachments:
        Table({Name:"PDFhealthCheck.pdf"; ContentBytes:varPDF
        })});;
 
Notify("O Email com sucesso!"; NotificationType.Success);;


Can somebody help me? or give some ideia?

Tks,
 
DK.
Categories:
I have the same question (0)
  • MS.Ragavendar Profile Picture
    6,312 Super User 2026 Season 1 on at
     
    Share the visual layout of the screen.
     
    Instead of the refer container kindly refer the BodyContainer1_1.
     
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • LK-20051828-0 Profile Picture
    8 on at
    @MS.Ragavendar this is the layout.
    I tried to use the BodyContainer1_1 directly and the generated PDF still only with the info that is been visualized on the screen.
  • Suggested answer
    MS.Ragavendar Profile Picture
    6,312 Super User 2026 Season 1 on at
     
    My Layout,
     
    Actual Form resides in the View_FormContainer
     
     
     
    PDF Generation Code 
     
     
    Can you replicate a similar like this, I am not facing any issues. 
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    ✅ Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
     
  • MS.Ragavendar Profile Picture
    6,312 Super User 2026 Season 1 on at
     
    A quick follow-up to see, does the suggestion worked for you or still you were looking for any other approaches or assistance.
     
    🏷️ Please tag me @MS.Ragavendar if you still have any queries related to the solution or issue persists.
    Please click Accept as solution if my post helped you solve your issue and help others who will face the similar issue in future.
    ❤️ Please consider giving it a Like, If the approach was useful in other ways.
  • LK-20051828-0 Profile Picture
    8 on at
     
    Sorry, I was busy yesterday, but still not working.
     
    I think it's a limitation on the PDF(), it seems to only saves on the file what the sreen render.
    I tried to use the View_FormContainer and also a html text, all of them returned the same error,
     
    Do u have any ideias?
     
    Tks,
    Dk.
  • Craig.Engbrecht Profile Picture
    18 on at
    Hello LK-20051828-0, 



    I have run into this issue too with many different caveats. 



    For my PDF's I use a flow, but the input to the email should be the same. 

    For my single page details, I use a gallery inside of a container. 

    Its named this for reference, but probably not important: AttendanceFormtoPDF_con_PDFAreaSelector



    This is then what I use to ship it off to the flow: 
     
    UpdateContext({
        lclBlob:
        PDF(AttendanceFormtoPDF_con_PDFAreaSelector, {Margin: "7mm"})
    });
    
    Notify( "Saving to SharePoint.", NotificationType.Information, 15000);
    Base64toPDF.Run(
        {
            name: colPrintTimesheet.FileName,
            contentBytes: lclBlob
        },
        colPrintTimesheet.FileName,
        colPrintTimesheet.'Full Name',
        colPrintTimesheet.Title,
        Text( colPrintTimesheet.'Timesheet Date', "yyyy-mm-dd"),
        colPrintTimesheet.Department,
        " ",
        {
            text_3:
            "Timesheet"
        }
    );
     

    For our multi page PDF (Multi page here being a misnomer... Its really one SUPER long page encompassing the number of items we want as pages. )

    We use this code: 

    What this does is set the height of the template to the height of one page, and the total gallery height to the height of a page times the number of pages we need ( Or number of Time Summaries ).
    UpdateContext({
        lclShowPDF:
            false
    });
    UpdateContext({
        lclPrintSettings:
            true, 
        lclPDFSettings:
        {
            Height: 11 * 96,
            Width: 8.5 * 96
        },
        /*
            Formats the Print area to be the size of the pages multiplied by the number of rows when printing
        */
        lclTSPDFHeight: CountRows(colShiftTimecards) * ( If( CountRows(colShiftTimecards) < 2, 11, 11.4 ) * 96),
        /*
            Formats the Template Height to one full pages based on DPI
        */
        lclTSPDFHeightTemplate:
            (11.4 * 96),
            
        lclTSPDFWidth:
            (8.5 * 96)
    });
    
    UpdateContext({
        mergedPDF:
            PDF(
                TimeSummariestoPDF_gal_ShiftInformation,
                {
                    DPI: gblPDFSettings.DPI,
                    Margin: gblPDFSettings.Margin,
                    Orientation: gblPDFSettings.Orientation,
                    Size: gblPDFSettings.PaperSize,
                    ExpandContainers: gblPDFSettings.ExpandContainers
                }
            )
    });
    
    Select( TimeSummariestoPDF_btn_PageSizing );
     
     
     
    Once that has been adjusted it sends it to a different version of the flow, as I wasn't certain at the time if it was going to be a single blob, or many. 

    I could have iterated through the items, but it never would have worked to join them after without a third party plugin. 



    For that second example, we only print the gallery ( TimeSummariestoPDF_gal_ShiftInformation ), as nested galleries don't work. 





    If you'd like to know more, please let me know. :) 
  • LK-20051828-0 Profile Picture
    8 on at
     
    If you could show me more, I would really appreciate,
     
    Tks
  • Craig.Engbrecht Profile Picture
    18 on at
    Hello LK-20051828-0,

    What would you like to see more of? 
    What do you think is missing from the information? 

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 519 Most Valuable Professional

#2
11manish Profile Picture

11manish 489

#3
Haque Profile Picture

Haque 327

Last 30 days Overall leaderboard