We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF ignores image when image path is relative in html


I am using aspose pdf for java version 10.9.0 and converting html to pdf. My html files contains an image and its path given as relative. Html displays image properly but after converting into PDF , out put file does not have added image. PDF is a read only pdf.

Please find attached files for easy reference.


Hi Prasanta,

Thanks for contacting support.

Can you please share your source/input HTML, so that we can test the scenario in our environment. We are sorry for your inconvenience.

PS, I am afraid I could not see the files attached with your earlier post.

Hi Nayyer,

please find attached file relative-path-issue.zip.


Hi Prasanta,

Thanks for sharing source document. Please use new DOM approach for HTML to PDF conversion and pass basepath to HtmlLoadOptions object for external resources as following. It will help you to accomplish the task.

HtmlLoadOptions options = new HtmlLoadOptions(@“E:\data\relative-path-issue\relative-path-issue”);<o:p></o:p>

Document doc = new Document(@"E:\data\relative-path-issue\relative-path-issue\!QC Org DM_EForms_Recipient 2.html",options);

doc.Save("E:\data\relative-path-issue\relative-path-issue\!QC Org DM_EForms_Recipient 2.pdf");

Please feel free to contact us for any further assistance.

Best Regards,