TIF transparency / opacity not considered when saving DOCX as HTML

Hi,

I am generating HTML from a .DOCX file which does have a TIF file embedded. This TIF does have 4 channels (RGB + Alpha).

When saving as SaveFormat.HTML_FIXED the alpha channel is not considered (and the resulting document looks bad). However when saving as SaveFormat.HTML the alpha channel is taken into account and the document is fine. Seems to be due to the first way converting TIF to JPG and the second approach converting TIF to PNG.

That looks like a bug or is there some kind of way to push aspose.words to respect transparency or generate differently formatted images during generation?

package org.example;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;

public class Main {
    public static void main(String[] args) throws Exception {
        Document document = new Document("path\\to\\docx.docx");
        String outputPathHTML = "path\\to\\html.html";
        String outputPathHTMLFixed = "path\\to\\htmlFixed.html";

        // Produces a good output with images in png format
        document.save(outputPathHTML, SaveFormat.HTML);

        // Produces a messed up output with images in jpeg format
        document.save(outputPathHTMLFixed, SaveFormat.HTML_FIXED);
    }
}

@sebastian.rollwage.c Could you please attach your sample input document here for testing? We will check the issue and provide you more information.

Input document:
docx.docx (1004.1 KB)

Generated HTML_FIXED (bad):

Generated document or HTML (good):

@sebastian.rollwage.c Thank you for additional information. Unfortunately, I cannot reproduce the problem on my side using the latest 23.1 version of Aspose.Words for Java. I have used the following simple code for testing:

Document doc = new Document("C:\\Temp\\in.docx");
doc.save("C:\\Temp\\out.html", SaveFormat.HTML);

out.zip (115.7 KB)

Ok, seems as if no longer jpegs but pngs are generated that support transparency. I guess I’ll have to update to a newer version then to fix that.

Thank you!

1 Like

Well, a little oversight on my side: I had HTML and HTML_FIXED mixed up in the text (it was correct in the code though). Only the HTML_FIXED version is messed up due to resorting to jpegs instead of pngs (and I need the FIXED version).

I found this article here Converting to Fixed-page Format in C#|Aspose.Words for .NET which specified that it is possible to have custom options when saving fixed formats. Is it possible to use fixed and e.g. specify to save PNGs instead of JPGs?

@sebastian.rollwage.c Thank you for additional information.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-24966

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

1 Like