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

Free Support Forum - aspose.com

Saving a PDF into HTML format with losing image colors


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;

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

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

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

String outHtmlFile = “SomeUnexistingFile.html”;
pageDoc.save(outHtmlFile, htmlSaveOps);
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,


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.


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


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