Saving a PDF into HTML format with losing image colors

Hi


I us Aspose PDF 17.5 to save a PDF file into HTML format.
In this PDF file, there are some color missing in the result.
Please check this issue, and attachment, thank you.


P.S. here is my code:
public void asposeConvert() throws Exception {

String fileName = “DF_textColor7.pdf”;

Document pdf = new Document(“input/”+fileName);

HtmlSaveOptions htmlSaveOps = new HtmlSaveOptions();
htmlSaveOps.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
htmlSaveOps.FontSavingMode = HtmlSaveOptions.FontSavingModes.AlwaysSaveAsWOFF;
htmlSaveOps.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
htmlSaveOps.LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
htmlSaveOps.setSplitIntoPages(false);

File f = new File(fileName + “/”);
f.mkdirs();

for (int p = 1; p <= pdf.getPages().size(); p++) {
Document pageDoc = new Document();
pageDoc.getPages().add(pdf.getPages().get_Item§);

final ByteArrayOutputStream stream = new ByteArrayOutputStream();
htmlSaveOps.CustomHtmlSavingStrategy = new HtmlSaveOptions.HtmlPageMarkupSavingStrategy() {
@Override
public void invoke(com.aspose.pdf.HtmlSaveOptions.HtmlPageMarkupSavingInfo htmlSavingInfo) {
try {
byte[] resultHtmlAsBytes = IOUtils.toByteArray(htmlSavingInfo.ContentStream);
htmlSavingInfo.ContentStream.read(resultHtmlAsBytes, 0, resultHtmlAsBytes.length);
stream.write(resultHtmlAsBytes);
stream.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
} finally {
IOUtils.closeQuietly(htmlSavingInfo.ContentStream);
}
}
};

String outHtmlFile = “SomeUnexistingFile.html”;
pageDoc.save(outHtmlFile, htmlSaveOps);
IOUtils.write(stream.toByteArray(),
new FileOutputStream(fileName + “/” + p + “.html”));
}
}

Hello Cheng,


Thanks for posting your inquiry.

I have tested the scenario in our environment and was able to replicate the issue. Therefore I have logged an issue as PDFJAVA-36824 in our issue tracking system, for the sake of correction. We will further look into the details of the issue and keep you informed with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.


Best Regards,

@ChengHuang,

Thanks for your patience.

We are pleased to share that the issue reported earlier as PDFJAVA-36824, is resolved in latest release of Aspose.Pdf for Java 17.7. Please try using the latest release version and in case you encounter any issue or you have any further query, please feel free to contact.

Hi
@codewarior

Thanks for the notice.
I tried with this release. This issue seems to be fixed.

@ChengHuang,

Thanks for the acknowledgement.

We are glad to hear that your problem is resolved. Please continue using our APIs and in the event of any further query, please feel free to contact.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan