IronPDF html query parameter

112 Views Asked by At

Does IronPDF support html query parameters, or is there an alternate method?

I've been using IronPDF to convert an html file to PDF using the following method: var pdf = ironRenderer.RenderUrlAsPdf(reportPath);

However, the html located at reportPath now requires a parameter userid. I have tried var pdf = ironRenderer.RenderUrlAsPdf(reportPath?userid=1); but that gives me the following error: CheckHtmlFilePath - File not found: .../index.html%3Fuserid=1'

I can't see any documentation in IronPdf that parameters are supported. Does anyone have any work arounds?

1

There are 1 best solutions below

0
On

Instead of adding the parameter to the variable name, add it to the string. For example:

reportPath += "?userid=1";
var pdf = ironRenderer.RenderUrlAsPdf(reportPath);

Check the URL to see if there is already a parameter, and manipulate the URL string accordingly. If you posted more code I could have described more.