Aspose Words 23.10 does not allow keeping original links when saving to HTML

Hello,

I’m using AsposeWords to convert doc and docx documents to HTML format.

In most cases I want not to convert images but still use their original url so I configured the HtmlSaveOptions that way:

HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
htmlOptions.setSaveFormat(SaveFormat.HTML);

htmlOptions.setExportImagesAsBase64(false);
htmlOptions.setExportFontsAsBase64(false);
htmlOptions.setExportFontResources(false);
htmlOptions.setExportOriginalUrlForLinkedImages(true);
htmlOptions.setImagesFolder("/some/tmp/folder"); // required else there is an error in Aspose

ByteArrayOutputStream out = new ByteArrayOutputStream();
doc.save(out, htmlOptions);
return out.toString(UTF_8);

If the document references for instance an image on wikipedia it properly outputs an HTML <img> with the src being the URL of that image.

It has worked fine for a few years but with Aspose 23.10 the src is the path of the image in the local image folder.

It looks like the call to setExportOriginalUrlForLinkedImages is no longer working. Is there a workaround?

1 Like

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

Thanks, here it is
docWithImage.zip (28.0 KB)

@galvarez
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-26121

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

@galvarez We have completed analyzing the issue and concluded it is not a bug. It’s not enough to specify ImageData.SourceFullName and you also should make sure that ImageData.ImageBytes of the shape are empty:

for (Shape s : (Iterable<Shape>)doc.getChildNodes(NodeType.SHAPE, true))
{
    s.getImageData().setImageBytes(null);
}

We will update HtmlSaveOptions.ExportOriginalUrlForLinkedImages property description to make it more clear.

1 Like

Thanks!
You code solves the issue when testing with Aspose Words 23.11.

1 Like