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

Community site session details

Session Id : Vl025xPvCEeKiw/tPJwPMH
Power Apps - Building Power Apps
Answered

Use PDF function on Screen without Target PDF Function

Like (0) ShareShare
ReportReport
Posted on 26 Oct 2023 17:36:04 by 227

Hello,

 

I am trying to set a button on my submitted screen to run a flow, and my PDF function on another screen. My formula is:

Navigate(PrintScreen);
Notify(
 "PDF is being generated. Please wait...",
 NotificationType.Information
);
Set(
 varSavePDF,
 SavePDF2.Run(
 "Generated Report.pdf",
 {
 file: {
 name: "Generated Report.pdf",
 contentBytes: PDF(
 PrintScreen,
 {
 Orientation: "Portrait",
 ExpandContainers: true
 }
 )
 }
 }
 )
);
Launch(varSavePDF.fileurl);
Navigate(SubmittedScreen)

 

When I preview the app this works. When I publish the app and try it I get "The target of the PDF function must be on the current screen".

 

Any ideas on how I can get this to work in my published version?

 

Thanks,

 

Collin

I have the same question (0)
  • collinktx Profile Picture
    227 on 27 Oct 2023 at 04:11:46
    Re: Use PDF function on Screen without Target PDF Function

    Hi @WarrenBelz ,

     

    This worked. It did make my page not really come out full portrait. So I played around and navigated to the printscreen. I put my code to run the pdf function and flow on the OnVisible Property and made a variable to start a timer that when down navigate back to my original screen. It ends up giving me the page a bit better. I do like your solution if i am not trying to do portrait view I will go with that. 

     

    As always thanks for the help. Thanks for your solution becuase it got me thinking there are other ways to do this which led to my version of a solution.

     

    Thanks,

     

    Collin

  • Verified answer
    WarrenBelz Profile Picture
    150,099 Most Valuable Professional on 26 Oct 2023 at 19:59:58
    Re: Use PDF function on Screen without Target PDF Function

    Hi @collinktx ,

    Firstly try it without the Navigate and see if that works., I tend to use a Container (you can make it full screen if you want) on the same screen and make it visible with a Variable just before printing and then hide it immediately after.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 936 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 375 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 330 Super User 2025 Season 2

Last 30 days Overall leaderboard
Loading complete