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

Free Support Forum - aspose.com

Images in generated HTML are not correctly displayed using Aspose.PDF for Java

Hi,

I have a small problem while generating HTML with embedded images.

I converted the PDF attached with the email. It generates the HTML correctly just the background image is not correctly rendered. I have also uploaded the generated HTML. Is there any setting which i should activate in code for it to render the image correctly?

Thanks for your help.

Best regards,
Imran Pariyani

test.pdf (110.5 KB)
Archive.zip (433.3 KB)

@pariyani,

Thanks for contacting support.

I have worked with source file shared by you using Aspose.PDF latest version 20.2 and unable to observe the issue. I have also shared my generated result with you for your kind reference. Can you please share which version of Asppse.PDF you are using along with sample code and environment details.output_outtest.zip (1.5 KB)

@Adnan.Ahmad

Thanks for your quick response. The file you attached does not contain embedded images. Could you please upload a life with embedded images. I am also using 20.2 version.

@pariyani,

Can you please check link and share feedback with us. I like to inform that I am able to view this properly on google chrome browser. Can you please share on which software you are opening this file.

@Adnan.Ahmad
Thanks for your reply. In the zip file that you attached and the link with the HTML both contains the following HTML Tag which is referencing an external svg file(which is not attached in the zip).

object data=“output_outtest_files/img_05.svg” type=“image/svg+xml” class=“stl_04” style=“position:absolute; width:49.5833em; height:70.0833em;”>
embed src=“output_outtest_files/img_05.svg” type=“image/svg+xml” /
/object.

I would appreciate it if you could generate an HTML with encoded embded image in the HTML itself.

for E.g <img src="data:image/png;base64…

Thanks for your help.

@pariyani,

Can you please share sample code which you used on your end so that we may further investigate to help you out. Also it seems that you are using Linux or Mac operating system on your end. Can you please confirm which operating system you are using.

@Adnan.Ahmad

Thanks for your reply. I am using the sample code attached below and the Operating system i am using is Mac.

Document doc = new Document(ConvertPDFtoXLSX.class.getClassLoader().getResourceAsStream("test.pdf"));

  // Instantiate HTML Save options object
  HtmlSaveOptions saveOptions = new HtmlSaveOptions();
  String outHtmlFile = "output.html";

  saveOptions.setFixedLayout(true);
  saveOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
  // save images in PNG format instead of SVG
  saveOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
  // save output as HTML
  doc.save(outHtmlFile, saveOptions);

@pariyani,

I have observed issue you mentioned and have logged it as PDFJAVA-39206 in our issue tracking system. We will further look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

@Adnan.Ahmad

Thanks for your reply and logging an Issue. Please let me know once you have more information.

@pariyani,

Sure, We will inform you.

@Adnan.Ahmad

If we buy the paid support how long will we have to wait then before all the issues which we have reported to be fixed ?

@pariyani,

I like to inform that paid support issues are treated on priority basis as compare to free support issues and are resolved as soon as possible.