Forum Discussion

W_G_Ryan's avatar
W_G_Ryan
Helper I
3 years ago

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

  • 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.

    • W_G_Ryan's avatar
      W_G_Ryan
      Helper I

      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.