Html2pdf - Failed to parse URL

Hi,
if we try to convert a htmlfile with empty image-tag to pdf with aspose.pdf for java, we get a “failed to parse url” exception.

[EXCEPTION] class com.aspose.pdf.internal.l31f.lt - [MESSAGE] Failed to parse URL.
class com.aspose.pdf.internal.l31f.lt: Failed to parse URL.
com.aspose.pdf.internal.l31n.lI.lI(Unknown Source)
com.aspose.pdf.internal.html.Url.(Unknown Source)
com.aspose.pdf.internal.html.net.UrlResolver.resolve(Unknown Source)
com.aspose.pdf.internal.l45u.l0h.lt(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lj(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l44h.lI.lj(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lj(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lj(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lj(Unknown Source)
com.aspose.pdf.internal.l44h.lj.lI(Unknown Source)
com.aspose.pdf.internal.l44t.lh.lI(Unknown Source)
com.aspose.pdf.internal.l44t.lh.lI(Unknown Source)
com.aspose.pdf.internal.l38v.lI.lI(Unknown Source)
com.aspose.pdf.internal.l46p.lI.lI(Unknown Source)
com.aspose.pdf.internal.html.rendering.HtmlRenderer.render(Unknown Source)
com.aspose.pdf.l6p.lI(Unknown Source)
com.aspose.pdf.l6p.lI(Unknown Source)
com.aspose.pdf.ADocument.lI(Unknown Source)
com.aspose.pdf.ADocument.(Unknown Source)
com.aspose.pdf.Document.(Unknown Source)
at.gv.tirol.elak.ejb.upload.pojo.UploadedFileContainer.convertHtmlToPdf(UploadedFileContainer.java:156)

HtmlLoadOptions htmlOptions = new HtmlLoadOptions();
htmlOptions.setInputEncoding(“UTF-8”);
htmlOptions.setWarningHandler(new HtmlPdfConverterWarnings());
Document pdfDocument = new Document(“c:/temp/input.html”,htmlOptions);
pdfDocument.save(“c:/temp/output.pdf”);

HtmlPdfConverterWarnings overrides warning. Within warning, we log the warningmessage and return continue.

src0.zip (320 Bytes)

Kind regards

@dvtdaten

Thanks for contacting support.

We were able to replicate the issue in our environment while using following code snippet with Aspose.PDF for Java 19.4.

HtmlLoadOptions options = new HtmlLoadOptions();
Document doc = new Document(dataDir + "src0.html", options);
doc.save(dataDir + "HTMLtoPDF_19.4.pdf");

We have logged this issue as PDFJAVA-38555 in our issue tracking system for the sake of correction. We will further look into details of the issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-38555) have been fixed in Aspose.PDF for Java 19.8.