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

Free Support Forum - aspose.com

Cannot dynamic set word to html's image dpi

i have override ImagingSavingCallback class as below

public class HandleImageSaving implements IImageSavingCallback
{
private HtmlSaveOptions saveOptions;
public HandleImageSaving(HtmlSaveOptions saveOptions) {
this.saveOptions = saveOptions;
}
@Override
public void imageSaving(ImageSavingArgs args) throws Exception
{
// Change any images in the document being exported with the extension of “jpeg” to “jpg”.

if(args.getCurrentShape().getShapeType() == ShapeType.OLE_OBJECT){
saveOptions.setImageResolution(300);
}else{
saveOptions.setImageResolution(96);
}
}
}
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setExportHeadersFootersMode(0);
saveOptions.setImageSavingCallback(new HandleImageSaving(saveOptions));
saveOptions.setSaveFormat(SaveFormat.HTML);
// saveOptions.setOfficeMathOutputMode(HtmlOfficeMathOutputMode.MATH_ML);
doc.save(folder + “/images/” + fileName + “.html”,saveOptions);

when using this code ,i found that current image doesn’t use the resolution as i set,the next image does,i wondered how to change current image’s resolution dynamicly.

@feihaodong

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output HTML file that shows the undesired behavior.
  • Please attach the expected output that shows the desired behavior.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.