Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
tomepenn
New Member

Print and/or export to PDF from PowerBI Embedded Report

Gentemen, we asked out partners about this in early 2017.  The answer was end of the year or maybe first quarter for the export to pdf feature.  We only have one basic workaroud by using window.print(), and insturcting our enterprise users to then print to pdf, which requires clicks and local pdf executables.  It isn't a solution we want to present.  

 

Does anyone have any news or an update form the engineering team?  Can someone that monitors this board please respond and/or reach out to Microsoft engineering team and ask for an update and reply here?  It is becoming a moderate to serious concern for a customer of ours planning significant launches in the near future.

 

Nimrod from the PowerBI team seems to be active on other PowerBI Embedded issues.  Maybe reach out to him?

 

Thanks for your help.

Tom

17 REPLIES 17
freddiec789
New Member

Printing and exporting to PDF from a PowerBI Embedded report allows you to create a static copy of the report that can be shared with others or used for reference. Here's how to do it:

  1. To print a PowerBI Embedded report, click on the "Print" icon in the top right corner of the report. This will open the print dialog box, where you can select your printer and adjust any print settings.

  2. To export a PowerBI Embedded report to PDF, click on the "File" menu and select "Export". This will open the "Export" dialog box, where you can choose PDF as the file type and select a location to save the PDF.

Keep in mind that when you print or export a PowerBI Embedded report, the resulting PDF or printout will only include the data and visualizations that are currently visible on the screen. It will not include any additional pages or hidden data.

If you want to include all data and visualizations in the PDF or printout, you may need to adjust the layout of the report or use the "Fit to page" option in the print dialog box. You can also use the "Export data" feature to export the underlying data used in the report to a separate file.

can we acheive this printing or exporting through node js also?
how this functionality can be acheived? using which API and which coding language. And how to bind any visual or report download to button you mentioning in your comment. 
As, by default you cant print or download any report page or visual in Power Bi embeded this functionality is available in Power Bi service. Or i am not aware of it.
If you can guide in this regard?
@freddiec789 

Still waiting

dom99
Advocate V
Advocate V

I have an update on this, spotted in the roadmap. Basically in Jan 2020 export to powerpoint/pdf/jpeg API will be in preview.

 

https://docs.microsoft.com/en-us/power-platform-release-plan/2019wave2/business-intelligence/api-exp...

 

 

Anonymous
Not applicable

The feature is currently scheduled for Feb 2020 (instead of Jan 2020).
Let's hope it does not get postponed again.

Fingers crossed, but not getting my hopes up!  

Bit disappointing but as you say let's just hope it arrives in Feb

Woot!!!  I will have much more 'buy-in' from the users if this is possible.  

stuartb
Frequent Visitor

I've been banging my head against Power BIs inability to export natively to PDF for some time.

What we have done is to utilise AWS Lambda functionality to run Chromium into which we embed the report and save that to S3, served back to the customer as a download.

It's a faff, annoying, but works quite well 
https://github.com/sambaiz/puppeteer-lambda-starter-kit/blob/master/README.md


I'm pretty sure you could adapt this for Azure Functions too....
Might help 

@stuartb 

I am running embedded powerbi in puppeteer in aws lambda, but I am getting hung up on knowing when the report is done being rendered. How do you wait for the report to finish, so you know its time to create the PDF (or whatever). Currently I am sleeping, but I am trying to find a better solution to that. I did try to hook into the "rendered" event, but I can't seem to get that to fire.

 

I also did hook up to the public preview of this feature, but the restrictions on it are far too great to be viable.

 

Any insight would be greatly appreciated!

 

-Kenny

Hi
Firstly kudos to the person/site that set me on the right track: https://www.sambaiz.net/article/132/
Secondly, it's been some time since I did this and we've changed the design from using Node to Pupeteer Sharp

Hope the following helps, it's a code snippet of the funtion that I used to embed the report.  Note it's not code complete nor would I suggest it's production ready! In essence all it does is wrap up the "embed" call in a promise and only then create the pdf.

 

Note: thee is a 'wait' in the code - I don't think I hooked up to the render with my prototype; just assumed that the API woudl render in less than 5secs. I know we did change this to something more robust, but I dont have access to the codebase for it as I no longer work on the project.

exports.exportPdf = async (browser, pbi) => {
    const magic = Math.floor(Math.random() * 100000);
    const filename = 'report-' + magic.toString() + '.pdf';
    const localPath = '/tmp/' + filename;
    loggit('>> generated filename: ' + filename);

    const pageHtml = '<!DOCTYPE html>' +
        '<html>' +
        '    <head>' +
        '    <meta charset="utf-8" />' +
        '    <title>Printed PDF</title>' +
        '       <style> #reportContainer { height: 750px; width: 100 %; max-width: 1000px; } </style>' +
        '    </head>' +
        '    <body>' +
        '    <h1>Report</h1>' +
        '    <div id="reportContainer"></div>' +
        '    </body>' +
        '</html>';

    loggit('>> new page');
    const page = await browser.newPage();

    loggit('>> generate filename');
    await page.addScriptTag({ path: './powerbi/powerbi.js' });
    await page.setContent(pageHtml);

    loggit('>>>Power BI stuff');
    await page.evaluate((a, b, c) => {
        const models = window['powerbi-client'].models;
        const config = {
            type: 'report',
            tokenType: models.TokenType.Embed,
            embedUrl: a,
            accessToken: b,
            id: c,
            permissions: models.Permissions.Read,
            viewMode: models.ViewMode.View,
            settings: {
                filterPaneEnabled: false,
                navContentPaneEnabled: false
            }
        };
        powerbi.embed(reportContainer, config);
    },
        pbi.EmbedUrl,
        pbi.EmbedToken.token,
        pbi.ReportId
    );

    loggit('waiting');
    await page.waitFor(5000);

    loggit('exporting pdf from chromium');
    await page.pdf({ path: localPath, format: 'A4', landscape: true });

    loggit('reading pdf');
    const aws = require('aws-sdk');
    const s3 = new aws.S3({ apiVersion: '2006-03-01' });
    const fs = require('fs');
    const pdf = await new Promise((resolve, reject) => {
        fs.readFile(localPath, (err, data) => {
            if (err) return reject(err);
            resolve(data);
        });
    });

    loggit('writing pdf');
    await s3.putObject({
        Bucket: 'a-stu-bucket',
        Key: filename,
        Body: pdf,
    }).promise();

    loggit('closing page');
    await page.close();

    loggit('returning');
    return filename;
};

 

Thank you Stuart!  

 

We do not run AWS, but I forwarded your response to my boss, who knows our systems and configurations.  It would be awesome to get this thing running!  

 

Regards,

Nancy

We are running into the same issue on our end. We have external users in the web application and we want to migrate them off of that into an embedded ISV solution, but we can't afford to lose the export to pdf option that the web service offers. Any ideas or thoughts about this issue would be greatly appreciated. 

Firstly I just want to say that Microsoft seem to missing a trick - the paperless office is a myth and virtually all our customers want the ability to print (some A3/A2 size) Management reports. I managed to use the above project using NodeJS to facilitate printing by automating Chromium in a way similar to the link I posted earlier. As Microsoft are creating a browser based on this technology (see: Dev Edge) I don't think this deviates from most peoples concerns of browser compatibility issues - for example; CSS styling across browsers. So I'm guessing you could automate that if you needed to. 

In essence what I did, was write this as a Serverless Function (AWS LAmbda in my case) using with entry point taking HTML (or DOM document) with the Power BI Token and config already embedded. It was just a case then using Puppeteer to create a page, inject the given document and export it as PDF (to a persistent file - though returning a file stream is equally valid).  We did notice some issues with CSS - some fonts were too small and we had to manipulate some styles to get the printing 'just right'. 

In testing we found this to be scaleable and performant. Scaleability was achieved by being serverless; horizontal scaling and not having to care about the number of Chromium instances being created. Performance was suprisingly quick - most functions took less than 5 seconds, that's including loading and running chromium and the overhead of API calls to api.powerbi.com to render the reports in web page.

The obvious thing here is that it requires development knowledge in order to create this. This is not something that can be done by a standard 'business team' - Microsoft should be able to offer this functionality relatively easily, but I guess it a case of priorities?

 

hi, 
Can we export any visual or complete embedded report using node js? i am looking to export single/multiple visuals from my embeded Power Bi report but i am not getting any help.
Have you acheived it somehow or any other idea you can share. As, for now the only option is taking screen shot using snip it or paint
@kk0036 @stuartb 




dom99
Advocate V
Advocate V

As far as I'm aware there is no functionality available which to me seems a hole in the eco-system seeing as the desktop has export to PDF, cloud service has export to PowerPoint, embedded has nothing.

I read somewhere that export to PPT would include all data in the report, but this is still the same screenshot with the data cut off, as exporting to PDF.  ARGH!!!  I just built several new dashboards to replace excel reports that my users have grown to love and depend on.  What a total waste!!!  

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors