QuestPDF / QuestPDF

QuestPDF is a modern open-source .NET library for PDF document generation. Offering comprehensive layout engine powered by concise and discoverable C# Fluent API. Easily generate PDF reports, invoices, exports, etc.
https://www.questpdf.com
Other
11.65k stars 603 forks source link

QuestPDF.Drawing.Exceptions.DocumentComposeException: Cannot load or decode provided image. #567

Closed seobjk closed 1 year ago

seobjk commented 1 year ago

I use Quest to generate PDF documents in my Azure Web App service with NopCommerce. Unfortunately, I get the following error, which I don't know what to do: QuestPDF.Drawing.Exceptions.DocumentComposeException: Cannot load or decode provided image.

I want to add a image to the header:

 row.ConstantItem(75).AlignRight().AlignTop().Column(stack =>
                        {
                            stack.Item().MaxWidth(75).MaxHeight(75)
                                 .Image("Themes/Platform/Content/images/Logo.png",
                                 ImageScaling.FitArea);
                        });

Anyone have an idea what could be the cause?

Thanks

MarcinZiabek commented 1 year ago

Are you sure that the image file is available under provided relative path? Please check using the File.Exists method from the standard library.

Best, Marcin

seobjk commented 1 year ago

Are you sure that the image file is available under provided relative path? Please check using the File.Exists method from the standard library.

Best, Marcin

Hi Marcin, thanks for your answer. It was the leading "\" in the file path. After this was removed, the PDF could also be created without errors.