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

Free Support Forum - aspose.com

.DOCX to HTML - does not save exact page to page content

Hi team,

I am using Aspose Word for Java (19.3), trying to save word document into html and expecting a exact page to page layout but actually there are more pages in html than word document.

        Document doc = new Document(inputStream);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        HtmlFixedSaveOptions options = new HtmlFixedSaveOptions();
        options.setSaveFormat(SaveFormat.HTML_FIXED);
        options.setPageIndex(0);
        options.setPageCount(doc.getPageCount());
        options.setExportEmbeddedImages(true);
        options.setNumeralFormat(NumeralFormat.SYSTEM);
        options.setExportEmbeddedCss(true);
        options.setUseHighQualityRendering(true);
        options.setExportEmbeddedSvg(true);
        options.setExportEmbeddedFonts(true);
        doc.save(baos, options);

PFA sample .docx input and .html is the output. sample document.zip (295.6 KB)

Is it really an issue OR am I doing something wrong?

@saket.malpure

You are using Aspose.Words without license. We suggest you please get the temporary license and apply it before importing the document into Aspose.Words’ DOM.

Thanks @tahir.manzoor for quick reply.
applied the license so now there is no evaluation copy image and warnings,
but it didn’t fix the issue, still there is 4 page html output for 3 page word document.
PFA input and output. sample_doc.zip (256.9 KB)

@saket.malpure

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, HtmlFixed, PDF or XPS). You need to install fonts that are used in your document on the machine where you are converting documents to HtmlFixed.

Please install Arial font to get the desired output.

1 Like