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

Free Support Forum - aspose.com

Avoid Skewed Output When Converting Word DOC Document to PDF using Java | Detect SmartArt Shape

Hi Team,

I am trying to generate a simple pdf document which contains some tables and text. Sometimes the output pdf has completely/partially skewed text. Weirdly, sometimes even if there is just a single line of text or just a single word, I am still getting the skewed output. However, the equivalent word document always has correct output which is not skewed. I have to admit that this issue is ocurring very rarely and really hard to reproduce and that’s why I won’t be able to provide any definite steps or sample code which you can use to replicate it consistently. I am using Aspose.Words 19.7 jar.

Have you ever witnessed any such issue before with pdf documents ? If yes, could you please provide a hint about what could be going wrong here ?
(I have placed a sample pdf and equivalent doc file in the attached zip) skewedOutputs.zip (19.6 KB)

@shubhampandey

We have converted the shared DOC file to PDF using the latest version of Aspose.Words for Java 19.9 and have not found the shared issue. So, please use Aspose.Words for Java 19.9.

@tahir.manzoor
Thanks for your prompt response. Could you please confirm through your testing if the issue exists in 19.7 ? If so, then what should be the course of action ? We just upgraded to 19.7 and again upgrading to 19.9 so soon is not an option.
Thanks !

@tahir.manzoor
Or if you can tell me whether this kind of skewed output is even possible in Aspose through some setting then that would also be really helpful ?

@shubhampandey,

Please make sure that you had attached the correct Word document (“skewed_output.doc”) here for testing; because we are unable to reproduce this issue on our end even when using old Aspose.Words for Java version 19.7 on Windows 10. Please see the PDF files that we generated on our end by using 19.9 and 19.7 versions of Aspose.Words by using the following simple code:

Code:

Document doc = new Document("E:\\skewedOutputs\\skewed_output.doc");
doc.save("E:\\skewedOutputs\\awjava-19.7.pdf");

Can you please also share your OS and JDK versions and any other environment details which will help us to reproduce the same problem on our end? Also, are you using the
Aspose.Words for Java 19.7 (JDK1.6 jar only) version or the regular JAR from Aspose.Words for Java 19.7 package?

@awais.hafeez
OS - Windows 10
JRE - IBM JRE version 7, 64 bit
We are using the regular JAR downloaded from -

https://downloads.aspose.com/words/java/new-releases/aspose.words-for-java-19.7/

@shubhampandey,

I am afraid, we are still unable to reproduce this issue on our end. Can you please confirm that you had provided the correct input Word document i.e. ‘skewed_output.doc’ (the ‘skewed_output.pdf’ is generated from)? Do you see skewed PDF output when converting this ‘skewed_output.doc’ to PDF on your end? Can you please also provide piece of source code to be able to reproduce the same problem on our end?

Unfortunately, we do not know how can Aspose.Words produce such a skewed output from this ‘skewed_output.doc’.

@awais.hafeez
Though I still don’t have the standalone code which would reproduce this issue, however, I have an interesting find. We had been using an older version of Aspose in our previous releases before the current upgrade to 19.7 and things worked fine with that version. I tested our product with multiple versions of Aspose and found that up until 19.6, we are not getting any skewed output. I even tested it using the latest jar i.e. 19.10 and I can still notice the skewed output. So, the skewing of the output starts exactly from version 19.7 as per our observation. I have attached the output pdfs generated using both versions 19.6 and 19.7.

The word outpts generated using both the versions show no problem at all (attached).

Also if I just try and convert the word document to pdf directly, using your sample code then the outputs are not skewed. So simply converting doc to pdf directly won’t reproduce the issue.

I understand that it would be hard for you as well to reproduce the issue without a sample code, but looking at what changed between 19.6 and 19.7 might give you some clue.

Thanks !
skewedCheck_Multi.zip (266.2 KB)

@shubhampandey,

Thanks for the additional information. But, we are still unable to reproduce this behavior on our end. We have logged a ticket in our issue tracking system to investigate this issue further. Your ticket number is WORDSJAVA-2214. There are hundreds of improvements, bug fixes etc that we integrated in each release of Aspose.Words and we are not sure what change can cause this behavior. Please provide us complete steps and piece of source code so that we can also reproduce this issue on our end. Thanks for your cooperation.

@shubhampandey,

It is to update you that we had implemented following prominent features in 19.7 version of Aspose.Words which can cause this issue on your end:

  • Feature to detect SmartArt shape
  • Improved row height calculation in specific scenarios where the cell has vertical text direction
  • Public API for dealing with linked text boxes
  • i.e.It was improved rendering of SmartArts, text boxes, cells. And it looks like you use one of these features in the result document.

Anyway, we are still unable to reproduce the issue on our end unless you share further input (i.e. sample code, steps etc).

@awais.hafeez
Thanks for the update. We’ll try to zero in on these features and get back to you with sample code.

I am from the same Product that Shubham was working.
This release we upgraded Aspose.Word to 20.6 and now a colleague got the same PDF skew issue again. The issue occurs intermediately. Refer attached PDF.

PDF_ce6e4389-916b-4653-a0cd-4ff150a67951.pdf (300.2 KB)

Regards,
Zeeshan Khan
IBM Engineering Lifecycle Optimization - Publishing

@Zeeshan_Noor_Khan,

Please ZIP and attach the following resources here for testing:

  • Your simplified source Word document
  • In addition to “PDF_ce6e4389-916b-4653-a0cd-4ff150a67951.pdf” that you had already shared, please save the final output to DOCX format and provide that Word file.
  • Please also create a standalone simple Java application (source code without compilation errors) that helps us to reproduce this problem on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start further investigation into your scenario and provide you more information.

Hello Awais,

We are very stuck with the text occurring at an angle(45 degree) in the code.
Thing is that we are not able to reproduce it in independent code to provide it to you. But we can’t stay like this and need to roll back to 19.3 version, but that is still not a long time solution.

The issue occurs in our application for first document generation and onwards it doesn’t occurs.

This is very major issue for our product “IBM Engineering lifecycle optimization - Publishing”.

Can you connect with main developers and check

  1. If any api in aspose word java that can enable or led text to appear diagonally( 45 degree).
  2. Any user possiblity that leads to text / paragraph to get printed diagonally? This issue occurs only first time the application starts and doesn’t occurs subsequently.
  3. Any preventive measures, if known?

Please let us know this information.

Thanks,
Zeeshan Khan
IBM Engineering Lifecycle Optimization Publishing

@Zeeshan_Noor_Khan,

We have logged your concerns in our issue tracking system and will keep you posted here on any further updates.

@Zeeshan_Noor_Khan, @shubhampandey,

We think that something in your graphic environment may produce these vertical offsets of glyphs. Please provide answers to the following questions:

  1. Do you perform some printing/rendering tasks just before the first run of application? Maybe vertical offsets of glyphs caused by old non-wiped settings of the graphic environment.
  2. Do you use HarfBazz plugin? Please check the scenario with and without HarfBazz plugin and let us know how it goes on both cases.

Thanks for your cooperation.