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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Use PDF function on Sc...
Power Apps
Unanswered

Use PDF function on Screen without Target PDF Function

(0) ShareShare
ReportReport
Posted on by 232

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

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,024 Most Valuable Professional on at

    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

     

  • collinktx Profile Picture
    232 on at

    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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard