Tag Archives: PDF Subscription

ByHariharan Rajendran

Power BI Report Subscription as PDF

This post explains you how to get the Power BI report subscription as a PDF format. Yes, this will be an interesting solution because Power BI doesn’t send subscription report in pdf/pptx formats. It is always image file as of March 2020. We may expect pdf/pptx formats in future updates.

There are many paid 3rd party applications are available to get the report in pdf formats but this post explains you the process or automation which converts the report easily with using your Power Automate license. Most of the organization are using O365/M365 for Power BI subscription. Those are still getting Power Automate licenses are free. Please check with your M365 admins.

Let me explain the scenario,

I have a report called “IT Spend Analysis Sample” in my workspace and I set up the subscription for all the pages of the report. As you know, it will trigger an email for each report page. I need to get a pdf with all the reports pages (images).

Challenges:

As we get separate emails for each report page, we need to collect all the images and combined them into a single file and get as pdf format.

I am using Power Automate for this whole process. This solution is using SharePoint folder to place the images and final pdf file but this is also possible with OneDrive & Local Folder or any other storage that Power Automate supports.

Steps

  1. Get all the image files from Email and place it on the SharePoint folder.
  2. Image to html conversion and place the html file on SharePoint folder.
  3. You can open and print the html file and save it as pdf file – This is a manual process which you need to perform as we have some issue with the size of the image on the pdf.

 

Step by Step

  1. I have created one Power Automate flow which extracts the image from outlook and place it on the SharePoint folder. There is a Power Automate template available for this process already so we can use this easily.

 

  1. Next, the main process – convert the images into single html file. Follow the below steps in Power Automate.
    1. Start with Recurrence Trigger or manual trigger based on your requirement. Set the time when you need to get the file place on the SharePoint. If you set 7 pm as Subscription time on Power BI report then try to set 7.15 pm on the Power Automate flow. because the other file should get the image from mails and place it on the SharePoint folder.
    2. Use “Get files (properties only)” action and point to the Power BI report images as like below.
    3. Initialize 3 variables – FilePath, JPG & Report.

            4. Next, “Apply to each” condition.

5. Set variable FilePath as “Filename with Extension”.

6. Next, “Get file content using path” action. Check the value below.

7. Set variable JPG as – dataUri(body(‘FileContent’))

8. Next, Append to variable Report – concat(‘<img src=”‘,variables(‘JPG’),'”/>’)

9. All the above processes are within apply to each loop and next add an action after apply to each. Create file in              SharePoint with html as file extension. Use variable report as file content.

That’s it. Now, run the flow it will store the pdf file on the given folder as like below.

Open the html and check the result. It will have all the images as one by one which is nothing but the report pages.

You can print the html and save as pdf. It is a manual process.

Added the screenshot of full flow. Please check it and let me know if you have any doubts.

One more information, Microsoft Power BI team has released new REST API to easy this process. I will cover that in my next post so stay tuned.

Happy Learning!!!

 

1