cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
rmc
Level: Powered On

PDFViewer Control Reset

Hi All,

 

Created a Power App to upload a PDF file to a SharePoint Document Library and included the PDF Viewer control so the user can preview the file that they selected via the Attachment control before submitting the file.

 

I reset all the controls (dropdowns, date pickers, text fields, etc.) after they hit the Submit button, however I am not able to reset the PDFViewer control. It just continues to display the last file that was selected via the Attachment control. Tried various options but with no luck.

 

Any ideas welcome!

 

Thanks

Mark

4 REPLIES 4
dynamicsedge
Level 10

Re: PDFViewer Control Reset

@rmc 

 

So even if you tried to change the Document parameter, it still shows the last file?

Community Support Team
Community Support Team

Re: PDFViewer Control Reset

Hi @rmc ,

Pdf viewer control is not a resetable control.

So resetable function will not work for this control.

As an alternative way, you could change the pdf's Document based on a variable.

When you click the submit button, the variable value change.

For example:

Set the screen's OnViSible:

Set(var,true)

Set the submit button's OnSelect:

SubmitForm(Form1);ResetForm(Form1);Set(var,false)

set the pdf viewer's Document:

If(var,Last(attachment controlname.Attachments).Value,SamplePdf)

 

Then if you submit the form, the pdf viewer will display sample pdf.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
rmc
Level: Powered On

Re: PDFViewer Control Reset

Thank you @v-yutliu-msft ,

 

The only issue with that is it shows the default text "Lorem ipsum..." and I would like it to be blank. Do know where the SamplePDF file is located and can we edit it?

 

Found a solution, I just created an additional PDFViewer control on top of the existing one and toggled the Visible property to mask the original control.

 

Thanks

Mark

 

dynamicsedge
Level 10

Re: PDFViewer Control Reset

@rmc 

 

That's a good idea.

 

Another idea is that the visible could be false on the same control if no PDF file is there. To avoid invalid code, you'd need to use the Sample PDF as the value of Document. You would do this by checking if another part of your app has defined the PDF using an IF statement - if it has not, you would do what's described here - this IF statement would also be on the "Visible" property of the control as well.

 

This is in case you want to avoid using more than one PDF control.

 

If you are masking the other one, you may already be somewhat doing this. The next step to make it a little bit cleaner is to make it so that you use one and not two controls.

 

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,194)