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 Platform Community / Forums / Power Apps / I would like to hide a...
Power Apps
Answered

I would like to hide a container and my PDF viewer from user

(0) ShareShare
ReportReport
Posted on by 26

I am fairly new to Power Apps and I am currently working on an App which I have to produce a PDF.

 

I currently have a screen which the user has access to view and input their data, I then have a separate screen which creates my PDF using a Container, PDF viewer and a button to submit my data into another environment.

 

This is working fine but I do not want the Users to be directed to the PDF screen.  I want them to be able to submit the PDF on the screen which they are working.

 

I have tried to do this using a button but as my PDF is in a separate screen it does not work.

 

I then tried to transfer my Container, PDF viewer and button onto the user screen and hide them but as the Container is hidden it does not work.

 

Does anyone have any idea how I should now approach this as I am struggling a little.

 

Many Thanks

Categories:
  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Wendy3 ,

     

    Could you please share more details? What does the Container contain? Why do users need to input data on one screen and then go to another screen to generate PDF?

     

    Best regards,

  • Verified answer
    jkic Profile Picture
    150 on at

    Hi

    How are you generating the PDF?  The PDF Viewer can let you view it, but not in itself create it.     I had a similar, but not quite the same, challenge recently, creating a PDF with data not visible to the Users.  I tried 2 approaches.

    Option 1 - Using the (Preview) PDF function to create the PDF.  The PDF function can reference specific Containers, Galleries, etc, so I used a Rectangle and Spinner to hide my controls, while the PDF function created the PDF.  The problem I found was that the PDF function did not render the controls exactly as required, with chevrons not hidden, text a bit squashed, especially with Modern controls.  I gave up on this approach and tried...

    Option 2 - Power Automate.  Pass your data from Power Apps into a Flow and use that to generate the PDF. 

     

    You might try a version of  my Option 1 - making the Container visible while the PDF is created/submitted, but hiding it behind another control (e.g a rectangle).  So your button.OnSelect looks something like...

    UpdateContext({varVisibleRectangleSpinner:true});  //hides everything, make sure these shapes are at the front!

    UpdateContext({varVisibleContainer:true});

    <generatePDF> //however you are doing this

    UpdateContext({varVisibleContainer:false});

    UpdateContext({varVisibleRectangleSpinner:false}); 

    Notification(Success,"your pdf has been saved or whatever")

     

    JK

  • Wendy3 Profile Picture
    26 on at

    So the user screen is to create an Invoice.

    It brings in data from a previous screen provided from a purchase invoice allowing them to use the same data for the Sales Invoice. 

    The user can review the data and edit the data. 

    I then need them to press a Submit button which creates the PDF.

     

    The PDF is currently created on an additional screen using a container which copies the information from the user screen and uses a PDF viewer.

     

    Once they press the submit button it then uploads the PDF to our invoicing system.  

     

    I have the submit button currently on the PDF page and this works but when I try to put a button referencing the PDF page onto the user screen it will not work.

     

    I also tried to put the container, PDF viewer and button onto the user page and hide them but this sent a blank copy over to our other system.

     

    Hope this makes sense.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Wendy3 ,

     

    Why not let user to review and edit data in the Container on user screen, submit the container and create PDF user PDF function then use a hidden PDF Viewer? I mean, what's the reason for using the extra Container?

     

    Best regards,

  • Wendy3 Profile Picture
    26 on at

    Unfortunately the user screen is not in a Container and includes a lot of fields you would not want to appear on the invoice.  I designed the Container for the PDF to replicate the invoice template just taking in all the data required from the user screen.

  • Wendy3 Profile Picture
    26 on at

    This looks like a solution but being new I have never done a rectangle spinner.  

    Please could you help direct me in the best way to do this.

    I have watched some videos but cannot find the best one.

  • v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @Wendy3 ,

     

    I think you can have two containers on the edit screen, one includes data that won't appear in PDF, the other includes all data for generating PDF. So, you just need to PDF() the second Container.

     

    Best regards,

  • jkic Profile Picture
    150 on at

    Hi

    You insert a Rectangle on the screen, if you have a header/banner of height 80, you would place the Rectangle with X=0, Y=80, Width=Parent.Width, Height=Parent.Height-80.  Then it will cover entire screen except the banner.  Set the .Visible to varVisibleRectangleSpinner.  Give it a Color so it's not transparent.

    Next, add a Spinner control - it's a Modern control so if you don't have Modern controls enabled, go to Settings-Upcoming Features and search for 'Modern' and toggle it on.  Then when you go back to Insert menu you should see Classic and Modern, click Modern and select Spinner.  Position it in the center of the screen (I tend to use Y=Parent.Height/2-Self.Height/2, X=Parent.Width/2-Self.Width/2).  Also set its .Visible property to varVisibleRectangleSpinner.  

    Important - make sure these 2 controls are at the front of your screen so they appear on top of everything else, and make sure the Spinner is first otherwise the rectangle hides it!

    Then use the code in my first reply for the button's OnSelect and you should see the Spinner appear, and everything else except banner is hidden.

    As a modern control, you can't change much about the spinner, but you can add a label, and change its size and color.

    spinner.png
  • Wendy3 Profile Picture
    26 on at

    OK I'm getting there.   So as I said I am very new to power apps.  I have managed to do all of the above but unfortunately I am struggling to put the colour on the rectangle.  It is constantly transparent even when I try to change the colour.  Please could you explain this bit for me.  Many Thanks

  • Wendy3 Profile Picture
    26 on at

    Thank you for this suggestion but the complexities of the screen and space required would not allow me to use this option.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard