Power Apps Print Function

Microsoft has released a brand new function in Power Apps, called Print().  This is a very welcome addition to the list of possibilities with Power Apps, and has been a frequent request from customers.  It is really a print screen functionality, since there is no scrolling.

The function is very simple:

Print()

Just as with any action in Power Apps, you can use this function with a button, an icon, a label, whatever you’d like to click in order to print.  Here is a very simple example.  I have added an icon of a printer here at the top right corner of this screen:

powerapps-print-icon-form

What happens next? When I publish or preview the app, and click the print button, this is what I see:

powerapps-print-preview-project

A couple of things about this screen.  I am using the Chrome browser, so this print preview screen may look slightly different per various browsers and operating systems.  None of the settings on this screen can be controlled from the Power App, these are on the user’s desktop computer.

Destination:  This is the default printer on my computer.

(Mine is actually a LaserJet printer, but I switched it over to “Save as PDF”, which is built into Windows, for this demo.  End users can use this method to quickly save the form as a PDF!)

Pages:  It will always just have one page.  Even if you make your Power App screen very tall, it will not scroll to another print page.

Layout: This will default to the last setting that you used.  Mine had a default of Portrait, but I changed it to Landscape for this screenshot, since it looks nicer.

Notice that in this printout, although the fill color does not render, the “Submit” button and the arrow at the top left are showing.  With this new Print function, there is also the ability to hide and show certain objects on the screen depending on if it’s currently being printed. I’ve already done that with the print icon, here’s the syntax.  Select the control that you’d like to hide, and go to the Visible property.  The name of my current screen is scrProjectForm, and the Printing parameter returns a boolean letting me know if the screen is currently printing or not.  The ! (exclamation mark) at the beginning of this formula means the opposite.  So, therefore this button is only visible if this screen is NOT currently printing.  Therefore, it’s hidden when it IS printing.

powerapps-screen-not-printing

!scrProjectForm.Printing

Another thing that you could potentially do, is send other commands and/or even use a completely different screen for printing.  Microsoft has added a couple of new screens to the list of available screens, specifically for this purpose:

powerapps-new-screen-print

When you use the print function, one idea is to navigate to the screen that has the printable layout, right before the print function, and if you wanted the form to look like a read-only form, you could also use the ViewForm command, too.  You can even put another command that will navigate you back after printing.

Idea: Add a printer icon to the top of the screen, and in the OnSelect property:

Navigate(name of the screen you want to print);
ViewForm(name of the form on that screen);
Print();
Navigate(name of the screen you started on)

Now, you don’t *have* to navigate or have a special screen just for printing, you can simply print the screen you’re on.  Navigating is just an option, and it is definitely time consuming to build multiple forms on multiple screens.

Another idea – NO form control

The following is very time consuming, but can give you very printer-perfect results if your form needs to look a certain way, but it’s still not going to scroll.

You can use mostly labels and not use the form control at all.  Doing this solution entails having a record variable that stores all of the field data about the form, and this is something that I have in place in all of the apps that I create anyway, so it’s easy to implement.  When I click on the existing item / list item that I want to view, I always set a variable with that form data.

OnSelect before navigating to that item. Set(varSelectedRecord, ThisItem)   Like this.  Notice that the whole gallery is what I’ve selected here.

powerapps-set-varrecord

Anyway, so once you have this record in a variable, you can use that data to display it for print.

This leads me to the next creative thing that you can do when you create a printable screen.  Once you’re on the screen, the one that people fill out, the one with the form control, you can add a cute little printer icon, and set up this other screen, so that when the print icon is clicked, this is what gets printed:

powerapps-print-labels-only-screen

This is a screen with a bunch of labels on it. The name of each field is a label, and the value of the data in the field is a label.  Since I’ve set the record into a variable, I can refer to that in each label.  Here are some examples:

For a text field called Project Name, see I’ve typed varSelectedRecord.’Project Name’ for the label’s text.

powerapps-label-project-name

Project Manager is a people field:

image

Priority is a choice column:

powerapps-priority-choice-field

And then project description is long, and the length of the description can vary, so I set the property called AutoHeight to TRUE for that label.

Here is an hour long video where Joelle and I demonstrated the Print function.  The last part of this blog post with the labels is something I came up with later, so that is not in the video, but I do show a lot of tips and tricks in working with this function, and even show how to create a pop-up box that lets the user choose landscape or portrait.

power-hour-print-video

Happy printing!

Here is the official Microsoft documentation on this function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-print 

13 comments

  • This is super cool. I need to give this a try.

    Like

  • Laura – we installed the new Print() function on our employee directory. Work great directly in the app. But the app is embedded in a SP page for users to access. The function does NOT work when the app is embedded in a page. Any ideas?

    Like

    • That does sound annoying. Here’s a workaround: Instead of embedding the app in a page, add a hyperlink to your app on the SharePoint page, therefore it will open in a new window, as a full window.

      Like

    • That doesn’t surprise me, it’s a known bug unfortunately. I recommend just not embedding it, put a hyperlink on the page so that the app opens in a new tab. That’s the workaround for now.

      Like

  • Hi, Laura. The print() function does not seem to work with SharePoint forms customized with Power Apps. It works in the studio, but after publish, the print button does absolutely nothing. Do you know anything about this, is there a workaround?

    Like

  • I have following issue with printing custom form. In Power Apps, Print() function is working fine in Preview the app (F5) mode but after I publish it in SharePoint list it doesn’t. Clicking the Print button – OnSelect = Print() gives no result. I have tried different browsers but the result is the same. Another button for changing Screen views in the form is working fine in SharePoint. What can be the problem? I will be very happy to find out.

    Like

  • It there a workaround to print multiple screens together and auto-combine into one single PDF? Cheers.

    Like

  • Laura, thanks for updating the community on the Print() function, can you guide how to make the print function on a SharePoint custom list form, for some reason the print functionality does not seem to work when click on my SharePoint custom list form icon, however if i go to a preview mode in the power apps studio the print function works( but does not help us) because we want the print to be available on an Edit or View mode (with data showing).

    Like

  • Hello, I am wanting to add the company logo to the printed doc, the logo is an image file on the power app, for some reason, it will not show up on the print, any ideas? Using edge as a browser. Thanks

    Like

Leave a Reply to Zarski Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.