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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
ozpbi123
Regular Visitor

Exporting PDF/PPT with current state via API

Hello,

Following instructions from other posts, I am attempting to export an embedded report into a PDF or PPT file with the current state of the report via the following:

 

1. When the user chooses to export their report, I get the current state via the Javascript API:

 

var capturedBookmark = await this.report.bookmarksManager.capture();

 

 

2. I verify that I get a state value string, and then when exporting via the powerbi api where state is that state string captured in step 1:

 

var export = await client.Reports.ExportToFileInGroupAsync(new Guid(workspaceId), new Guid(reportId), new ExportReportRequest()
                {
                    Format = fileFormat,
                    PowerBIReportConfiguration = new PowerBIReportExportConfiguration()
                    {
                        Identities = new List<EffectiveIdentity>() { effectiveIdentity },
                        DefaultBookmark = new PageBookmark(state: state)
                    },
                });

 

 

This however always returns an invalid request error of "Export report was provided with an invalid bookmark".

 

Is there something I might be missing here?

 

 

 

1 ACCEPTED SOLUTION
AmosHersch
Microsoft Employee
Microsoft Employee

Hi,

 

I don't see what is missing, the bookmark state should be some base64 which Power BI tries to decodes. The error probably means something was wrong during decoding. Maybe try to see in the network traces how the state you're sending looks like. If it's not a base64 string then it wasn't captured/passed correctly.

You can also try to apply the bookmark state using the Javascript API and see if it's valid.

View solution in original post

3 REPLIES 3
AmosHersch
Microsoft Employee
Microsoft Employee

Hi,

 

I don't see what is missing, the bookmark state should be some base64 which Power BI tries to decodes. The error probably means something was wrong during decoding. Maybe try to see in the network traces how the state you're sending looks like. If it's not a base64 string then it wasn't captured/passed correctly.

You can also try to apply the bookmark state using the Javascript API and see if it's valid.

The issue was an outdated powerbi-client package. Upgrading resolved the issue.

Anonymous
Not applicable

Hi, Do you have the steps to enable export to pdf/ ptt for powerbi reports embedded in web application for external users

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors