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

Free Support Forum - aspose.com

Wrong page number for doc to pdf

the origin doc file is 2 pages
The conversion result is 3 pages

here the origin doc file
my aspose-words version is 19.2
error_page_for_aspose.zip (17.1 KB)

code:
Document doc = new Document(bis);
doc.save(pdfFile.getAbsolutePath(), SaveFormat.PDF);

@yuweiming314,

Please also ZIP and attach the following font files here for further testing:

  • 黑体
  • 微软雅黑
  • 宋体
  • Wingdings

微软雅黑 font is too big to upload

@yuweiming314,

If your ZIP file size is big then you can upload the ZIP file to Dropbox and share the Download link here for testing.

  • 黑体
  • 微软雅黑
  • 宋体
  • Wingdings

fronts.zip

@yuweiming314,

Thanks for sharing the Font files.

Please also convert (Save As) “error_page_for_aspose.doc” document (which is actually a XML file) to PDF format by using MS Word on your end and attach it here for further testing.

Please also convert “error_page_for_aspose.doc” document to PDF format by using latest version of Aspose.Words for Java on your end and attach it here as well for further testing.

Please also share your OS and JDK version (environment details). Thanks for your cooperation.

JDK VERSION: 1.8_162
os: win7

convert result:
convert_result.zip (166.4 KB)

@yuweiming314,

I am afraid, the “convert_result.zip” file contains only one Aspose.Words generated PDF. Please also convert (Save As) “error_page_for_aspose.doc” document (which is actually a XML file) to PDF format by using MS Word on your end and attach it here for further testing. Thanks for your cooperation.

@yuweiming314,

Regarding the linked issue WORDSNET-18422, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see below the analysis details.

Different versions of MS Word show this document differently. This happens because docDefaults missing pPrDefault tag. MS Word loads some predefined document defaults depending on MS Word application version in this case.

To control this behavior, we should specify LoadOptions.MswVersion.
Default value is MsWordVersion.Word2007, so, please, specify MsWordVersion.Word2016.

To get desired PDF output, please use this code:

LoadOptions lo = new LoadOptions();
lo.MswVersion = MsWordVersion.Word2016;

Document doc = new Document("E:\\error_page_for_aspose\\error_page_for_aspose.doc", lo);
doc.Save("E:\\error_page_for_aspose\\19.4-fonts-installed.pdf");

Hope, this helps.