PdfSaveOptions saveOptions = new PdfSaveOptions();
File converted = new File("C:\\output.pdf");
Document doc = new Document("C:\\nput.docx");
doc.getChildNodes(NodeType.COMMENT, true).clear();
doc.save(converted.getAbsolutePath(), saveOptions);
“Output.pdf” has 26 pages while “input.doc” has 23 pages. (See attached)
Thanks!pageCount.zip (362.2 KB)
@ruhongcai
Thank you for your inquiry.
“Output.pdf” has 26 pages while “input.doc” has 23 pages.
We have reproduced this issue at our end and found Page # 18 table "Signal " rendered on next page and all onward pages moved to next and total number of pages increased.
However we have also tested this scenario with another DOC document contains 23 pages and found it is working properly Output.zip (149.6 KB). It appeared as this is
a particular issue with this document only. We suggest you to verify your this input document and try to test with other similar document and share your feedback here.
Thank you for your cooperation.
Thanks for the prompt response.
We have integrate Aspose Word and convert the doc/docx to pdf and display them in our tool.
All the document comes from customer side, we have tested lots of document from our customer side,
we have found this problem for some document, some work OK in Windows but not in Linux.
we still work with our customer to get permission to send those files to you.
About the original “input.doc” I sent, Page 18, any way Aspose could keep them in the same page or “fix” them? "Signal " rendered on next page and all onward pages moved to next and total number of pages increased. As I said, this not only happens in this specific file, please help to find root cause? Or any other option could select to avoid this to keep the page number the same?
Many thanks!
Ruhong
@ruhongcai
Thanks for writing back.
we have found this problem for some document, some work OK in Windows but not in Linux.
we still work with our customer to get permission to send those files to you.
It will be more accurate to have couple of files to compare and find the root cause for resolution. As soon as we have the files we will investigate this issue further in detail. Thanks for your cooperation.
Hi,
Thanks for reply, we have experience couple cases for “wrong page issues”, we need to get permission from our customers to send the files to you.
The attached “pageCount_twocases.zp” contains
-
Input_1.doc
output_1.pdf
These are the original problem I reported, easily reproduced in Windows.
You replied:
"We have reproduced this issue at our end and found Page # 18 table “Signal " rendered on next page and all onward pages moved to next and total number of pages increased.”
So seems you reproduced the issue, anyway could Aspose convert Doc to Pdf following the original page?
-
input_2.doc
input_2_linux_information
Tested in linux specific (see input_2_linux_information), easily found that the page in pdf is different than that in original, however it works OK in Windows.
Thanks for help!
RuhongpageCount_twocases.zip (576.2 KB)
@ruhongcai
Thank you for the details. We have logged this issue WORDSNET-16284 for further investigation and resolution. As soon as we have any further information to share we will update you here. Thank you for your cooperation.
@ruhongcai
,
The issues you have found earlier (filed as WORDSNET-16284) have been fixed in this Aspose.Words for .NET 18.2 update and this Aspose.Words for Java 18.2 update.
Please also check the following articles:
Hi,
The second case seems not working
Tested in linux specific (see input_2_linux_information)
Seems it happens because of “Aspose” didn’t managed to find “original” font in the system and “Aspose” just replace it with another one. In such situation text didn’t fit to page and expands the document.
Thanks!
Ruhong
@ruhongcai,
Please copy required fonts from Windows machine into your Linux machine.
I have generated PDF file from input_2.docx by using the latest licensed version of Aspose.Words i.e. 18.2 and attached it here for your reference (see 18.2.pdf (203.0 KB)). Please create a comparison screenshot highlighting (encircle) the problematic areas in this Aspose.Words generated PDF and attach it here for our reference. We will investigate the issue further on our end and provide you more information.
(1) Test with input1.docx
Problems:
- different page count on different systems
windows - 23 \ linux 28\ ubuntu -32
- First page not the same on different systems
windows - ok\ linux -not all data\ ubuntu - not all data + font style is different
(2) Test with input2.docx
screenshot_compare.zip (431.1 KB)
Please see the screenshot which shows the problem, page 14, (input2.docx).
(a)
dogfood ----- our server run in the following system:
Linux OS is Ubuntu 14.04
Java™ SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot™ 64-Bit Server VM (build 25.151-b12, mixed mode)
aspose-words.version=18.2
(b)ubuntu machine
Other linux system
Thanks!
Ruhong
@ruhongcai,
While using the latest version of Aspose.Words i.e. 18.2, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSJAVA-1746. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.
Please see the attached zip for other wrong count example. Thanks!
Ruhongother_wrongPage.zip (800.0 KB)
@ruhongcai,
Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-16850. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
@ruhongcai,
For this Word document, please also make sure that you have all the required fonts installed on the machine where you are using Aspose.Words.
Also, please render this Word document to PDF format on the same machine and share the generated PDF file here for our reference. Thanks for your cooperation.
Convert a Word Document to PDF
Hi,
(1) Code as the following
PdfSaveOptions saveOptions = new PdfSaveOptions();
File converted = new File("C:\\output_after_convert.pdf");
Document doc = new Document("C:\\nput.docx");
doc.getChildNodes(NodeType.COMMENT, true).clear();
doc.save(converted.getAbsolutePath(), saveOptions);
(2) Font is installed in Windows, no any error or warning catch.
(3)Please see the attached zip, you could see the output PDF miss the last part in the last page, then only shows “45 pages” while original input.doc has 46 pages.
Many thanks!
Ruhong
@ruhongcai,
Thanks for the additional information. But, I am afraid, I do not see any PDF attachment in your previous post. Please ZIP and reattach your generated PDF here for further testing.
The zip was too big to upload? 4 MB? Any other way to upload it?
Thanks!
@ruhongcai,
Please upload the ZIP file to Dropbox or any other file hosting service and share the download link here.
https://www.dropbox.com/s/jhwfomluh29o85j/other_wrongpage_2.zip?dl=0
@ruhongcai,
Thanks for sharing the PDF. Rest assured, we will inform you via this thread as soon as the linked issues are resolved.