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

Free Support Forum - aspose.com

Export PDF as HTML and PNG's with simple IMG tags in the HTML?

I am able to use your product to convert PDF’s in bulk to HTML files, but the images are being handled as SVG with OBJECT and EMBED tags in the HTML.

Can your product be configured to export the images as PNG’s and use simply IMG tags in the HTML?

I’m playing with the HtmlSaveOptions.RasterImagesSavingModes settings, but none seem to work the way I need it.

Please advise,


Hi Greg,

Thanks for your inquiry. Please check value of AsEmbeddedPartsOfPngPageBackground value of RaterImagesSavingModes, it saves image as PNG with img tag. Hopefully it will help you to accomplish your requirements. However if there is any difference in your requirements and my understanding then please share your some more details (input PDF and intended HTML), so we will look into it and guide you accordingly.

// Source PDF file<o:p></o:p>

Document doc = new Document("Test.pdf");

// Create HtmlSaveOption with tested feature

HtmlSaveOptions saveOptions = new HtmlSaveOptions();

saveOptions.FixedLayout = true;

saveOptions.SplitIntoPages = false;

saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;

string outFile = "Test.html";

// Save the output in HTML format

doc.Save(outFile, saveOptions);

Best Regards,

That option appears to take all of the images on the page and combine them into a single PNG that is included in the HTML via an IMG tag.

Is it possible to have each individual image placed into the HTML via separate tags?

Hi Greg,

Thanks for your inquiry. We are looking into your requirements and will update you soon.

Best Regards,

Hi Greg,

Thanks for your patience.

I have tested the scenario using one of my sample PDF file which contains 3 separate images on individual pages and when converting the file to HTML format, all of the three images are saved in separate tag. For your reference, I have also attached the resultant HTML generated over my end.

Can you please share your sample PDF file, so that we can test the scenario in our environment.