Convert HTML to PDF embedded base64 images

is it possible to convert html file to pdf, containing embedded base64 images

ver. 1 18-7305-001787.html.zip (3.1 KB)

@erikg

Thanks for contacting support.

We tried to convert your HTML template into PDF using following code snippet and noticed that the embedded image of QR Code was missing in the resultant PDF document. Hence, we logged an issue as PDFNET-45211 in our issue tracking system. We will further investigate the issue and keep you informed with the status of its correction. Please be patient and spare us little time.

Aspose.Pdf.HtmlLoadOptions objLoadOptions = new Aspose.Pdf.HtmlLoadOptions();
objLoadOptions.PageInfo.Margin.Bottom = 0;
objLoadOptions.PageInfo.Margin.Top = 0;
objLoadOptions.PageInfo.Margin.Right = 0;
objLoadOptions.PageInfo.Margin.Left = 0;
objLoadOptions.PageInfo.Height = PageSize.A4.Width;
objLoadOptions.PageInfo.Width = PageSize.A4.Height;
Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "HTMLWithEmbImage.html", objLoadOptions);
doc.Save(dataDir + "SamplefromHtml.pdf");

We are sorry for the inconvenience.

I am experiencing the same issue. Has there been any progress on this?

@bkane521

We are afraid that this issue has not been yet resolved due to other high priority issues. However, we have logged your concerns and will definitely let you know as soon as some significant progress is made towards resolution of this issue. Please spare us little time.

We are sorry for the inconvenience.

Hi Asad, understood. What is the recommended way of linking to images in html that will be converted to a pdf?

@bkane521

In case you need to display images in the PDF which are used in HTML, you can set path to the images and other resources in HtmlLoadOptions like following:

Document doc = new Document("linktoimage.html", new HtmlLoadOptions("PathToImages"));

However, in case you meant that images are anchored with tag and link should be working in PDF as well, you can please use following HTML tags for that in HTML file:

<a href='https://aspose.com'><img src='aspose.jpg' /></a>

The issues you have found earlier (filed as PDFNET-45211) have been fixed in Aspose.PDF for .NET 22.7.

Is this fixed and available in Java specifically JDK17 also?

@rprasadcr

Every fix in Aspose.PDF for .NET is ported into equivalent version of Aspose.PDF for Java. Please try using it and let us know in case you face any issues.