Html to PDF conversion issue when Html contains text with images

Hello Team,

We are having an issue with HTML to PDF conversion. first, we tried with the aspose.pdf package(24.2.0 package). At that time we were getting the error “The Type Initializer for ‘Gdip’ Threw Exception”.
after that, we tried with aspose.pdf.drawing package (24.6.0) and we were not getting above mentioned gdip error but we were getting 502 bad getaway error.

below is our code for HTML to PDF conversion -

using MemoryStream memoryStream = new MemoryStream(documentContent);
//documentContent - Byte array of Html Document
HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
var pdfDocument = new Document(memoryStream, htmlLoadOptions);
using MemoryStream generatedStream = new();
pdfDocument.Save(generatedStream, SaveFormat.Pdf);
generatedStream.Position = 0;
var byteArray = generatedStream.ToArray();
return Convert.ToBase64String(byteArray);

we tried with aspose online HTML to pdf converter, and by using this we are getting converted pdf without any error.

I have attached multiple HTML files in the attached zip file.

Downloads.7z (8.7 KB)

The above code is working fine locally on Windows machine but when we deploy the same code on server (Linux), we are getting the above-mentioned error

Note - I am part of the Conga organization, and we already have a paid license. If needed, we will post the question from the paid account.

@pthube

Can you please make sure that your deployed application has full access to the network. Such errors are mostly occur when API is not able to download a particular resource in the source HTML. In case it is not the case, we request you please share complete error description along with complete stack trace information. We will log an investigation ticket in our issue tracking system and share the ID with you.

we do not have any Network issues.
And we are not getting any logs for it.
from the above code snippet for this
var pdfDocument = new Document(memoryStream, htmlLoadOptions) ; ) line,
we are getting 502 bad getaway error.

@pthube

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-58427

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.