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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
W_G_Ryan
Helper I
Helper I

Need to get PDF Export for report through Code

The scenario I'm trying to solve for is that, I need to generate Monthly Statements (think of a bank) to PDF.  Each PDF is stored in a blob store and attached to an activity in dynamics.  I've been all up and down the API and I'm sure I'm doing something wrong but wanted to just check a few things.

 

1-If I use the QueryString in a browser, passing in the Parameters, the report renders and the PDF downloads.  I've tried using a HttpClient in C# to replicate this but all I ever get is an HTML page.  I'm not sure if that's because the HTML is returned first and a subsequent call returns the PDF or it's an authentication issue.

2-I've tried using the API but when I got through all of the authentication handshake items, I received an error that the report wasn't in a dedicated capacity.  I know, it's right there in the instructions as a big warning.  I'm trying to get dedicated capacity setup but just wanted to make absolutely sure there wasn't a way to do this through the WebAPI.

 

Does anyone know why this works as expected through the browser but won't work through Code?  On the same note, each month I expect to be printing roughly 500k of these, so I assume premium capacity would be needed no matter what but any guidance of suggestions on how to determine how much I might need would be helpful (i know this is a wide open Q, just looking for general guidelines if you've done anything similar).

 

3 REPLIES 3
lbendlin
Super User
Super User

You could consider using Power Automate to hide the complexity of the authentication and rendering process.  However there are severe limitations on the Export to File options (something like 8 requests per day) that  will make your 500K target hard to achieve.

Yah, I kind of feel dumb even asking.  The answer has got to be Power BI Premium Capacity and the API.  I am wondering though what that kind of performance is going to be like, b/c 500k pdfs is a lot of everything especially once a month.  Appreciate the help.

Never hurts to ask.  But to re-emphasize - anything over 8 extracts/exports per day will not work reliably. This is designed as an ad-hoc micro service, not for industrial scale.

 

Export Power BI embedded analytics reports API - Power BI | Microsoft Learn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Kudoed Authors