Shift context in table when convert .docx to .pdf

The problem ONLY happens in one of our Linux system, the output pdf shows shift context in table, please see the attached zip file which contains input.docx and output image file. It works in windows and other linux.
Not sure it relates to FONT size in system…shifted.zip (111.3 KB)

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);

Wondering if we should add some option to make it work?

@ruhongcai

Thanks for your inquiry. Unfortunately we are unable to reproduce this issue at our end from-shifted-input_docx_out.zip (42.6 KB).

Not sure it relates to FONT size in system

You can try to set setEmbedFullFonts to true or false to see the difference.

PdfSaveOptions options = new PdfSaveOptions();
options.setEmbedFullFonts(true);

For further detailed investigation. Please provide us these details.

  • Linux system details.
  • JDK Version.
  • Aspose.Words API version.

Thank you for your cooperation.

Hi,

Thanks for the advice, however it does not fix the problem.

Here is our linux information:

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=17.11

Thanks for the help!

Ruhong

@ruhongcai

Thanks for sharing details with us. We will try to reproduce this issue on shared information and then we will further investigate on it. We will inform you here once we have any update regarding this scenario.
Thank you for you cooperation.

@ruhongcai

We are sorry for the delay. We have investigated this further in detail and found using Aspose.Words 17.2 output is proper from-shifted-input_docx_out.pdf (23.6 KB). Please upgrade to Aspose.Words for Java 17.12. Thank you for your cooperation.

Hi,

Thanks for the update, however it does not fix the problem, Still shift context in table when convert .docx to .pdf

Here is our linux information:

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=17.12

Thanks for the help!

Ruhong

@ruhongcai,

Thanks for your inquiry. We have tested again the scenario on the same environment using latest version of Aspose.Words for Java 18.1 and have not found the shared issue. Please make sure that you are using the latest version of Aspose.Words for Java 18.1 and same input Word document. We have attached the output PDF with this post for your kind reference. 18.1.pdf (47.4 KB)

Hi,

I have tested the latest version 18.1 Aspose.Words and still see the problem.

Here is our linux information:

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.1

Thanks for the help!

Ruhong

@ruhongcai,

Thanks for your inquiry. Please make sure that you are using the same document that you shared in this forum thread. Please call Document.UpdatePageLayout method before saving the PDF.

If you still face problem, please share the output PDF that shows the undesired behavior. Thanks for your cooperation.

ok, thanks!

Ruhong

Hi,

One more question, call Document.UpdatePageLayout will work for all document? In other word, call Document.UpdatePageLayout before saving PDF could apply for all document?

Thanks!

Ruhong

@ruhongcai,

Thanks for your inquiry.

No, you do not need to call this method for every document.

This method is automatically invoked when you first convert a document to PDF, XPS, image or print it. However, if you modify the document after rendering and then attempt to render it again - Aspose.Words will not update the page layout automatically. In this case you should call UpdatePageLayout before rendering again.

Hi,

Thanks for reply, since during run time, our tool could not distinguish such document from others, so if add this line code , will work for all cases? In other word, adding this will cause other problem while solve this issue?

Thanks!

Ruhong

@ruhongcai,

Thanks for your inquiry. If you modify the document e.g. change the page orientation, remove the comments or any other modification that changes the page layout, please call Document.UpdatePageLayout. Otherwise, there is no need to call this method.

Hi,

“Call Document.UpdatePageLayout” does not solve the problem, the issue still exists.

Thanks!

Ruhong

@ruhongcai,

Thanks for your inquiry. Please share the output PDF that shows the undesired behavior. Thanks for your cooperation.

Hi,

Please see the attached zip file.

Thanks!

Ruhongshifted-convert.zip (111.8 KB)

@ruhongcai,

Thanks for sharing the Word documents. You have not shared the output PDF document that shows the undesired behavior.

We have tested the scenario using following code example and noticed that the text below the table is shifted towards right side of page in output PDF. We have attached the screenshots of input and output documents.
input.png (34.7 KB)
output.png (40.5 KB)

Document doc = new Document("C:\\nput.docx");
doc.getChildNodes(NodeType.COMMENT, true).clear();
doc.save(converted.getAbsolutePath(), saveOptions);

For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16365. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

We have not found any issue with the text inside table. You can check it in attached output.png.

Hi,

Thanks for your email, please see the attached shifted-convert_update.zip which contains input.doc and output.pdf, output.png (showing the problem in red line).

Many thanks!

Ruhong

@ruhongcai,

Unfortunately, we have not found the ZIP file (shifted-convert_update.zip) in this forum. Please attach it for further investigation. Thanks for your cooperation.