I'm facing an issue while generating PDF from html using ironpdf on Azure web app.

This is the exception I get:

Exception details:

Error while deploying Chrome dependencies. To learn how to solve this issue please read https://iron.helpscoutdocs.com/article/166-error-while-deploying-chrome-dependencies [Issue Code IRONPDF-CHROME-DEPLOYMENT-ERROR]

I followed the steps given in documentation but not able to crack this,

Code is working fine in local environment, I'm facing the issue in Azure web app.

This is the code:

using IronPdf

var Renderer = new HtmlToPdf();

var PDF = Renderer.RenderHtmlAsPdf(fullhtml);

It is throwing the error at the last line shown - can someone guide me how to successfully deploy this to Microsoft Azure?

3

There are 3 best solutions below

1
On

Right click the Project --> Open Properties --> Go to Events Sections --> Copy the this path XCOPY "$(TargetDir)runtimes" "$(TargetDir)bin/runtimes" /S /E /Y /I /R /D --> paste in the post-build event section

Run it --> problem will be solved

0
On

I also faced a similar kind of issue ([Issue Code IRONPDF-CHROME-DEPLOYMENT-ERROR-MAC-X64]).

Exceptionenter image description here

Why Error It's because of upgrading an "IRONPDF" version. I upgraded that from my windows machine so when I switch to another windows os it works well, but when I switch to mac os it throws this error.

Solution You have to install a "nuget package" according to your os. For my mac os, I need to install IronPdf.MacOs. So I executed the below command into the .net CLI, And after this installation, it worked perfectly fine.

dotnet add package IronPdf.MacOs --version 2022.12.11113

Here I attach my finding for the resolution, I hope it will also work for other os.

0
On

I had to change the WEBSITE_RUN_FROM_PACKAGE app configuration from 1 to 0. This is not very apparent but hidden in the documentation here: https://iron.helpscoutdocs.com/article/21-azure.