When generating a DOCX file from a PDF using Aspose.PDF, some alignment issues were observed

when generating a DOCX file from a PDF using Aspose.PDF, some alignment issues were observed with 20.10.0.0 version

image.png (40.3 KB)

@TrigynGMS

Cause

The alignment issues you are experiencing when converting a PDF to a DOCX file using Aspose.PDF version 20.10.0.0 may be due to the way certain elements are rendered during the conversion process. This can occur with complex layouts, fonts, or specific formatting that does not translate well between PDF and DOCX formats.

Solution

To address these alignment issues, consider the following steps:

  1. Update Aspose.PDF: Upgrade to a newer version of Aspose.PDF. Newer versions often include bug fixes and improvements that could resolve rendering issues.

  2. Use PdfSaveOptions: When saving the document, utilize the PdfSaveOptions class to specify additional options that may help with layout preservation. For example, enabling additional text positioning can improve the accuracy of text placement.

  3. Check Fonts: Ensure that the fonts used in the PDF are available on the system where the conversion is taking place. Missing fonts can lead to unexpected layout changes.

  4. Adjust Layout Settings: Experiment with different layout settings in the PdfSaveOptions, such as enabling or disabling options related to text compression, image compression, and document structure export.

Code Example

Here’s a sample code snippet that demonstrates how to use PdfSaveOptions when converting a PDF to DOCX:

Document pdfDocument = new Document("input.pdf");
PdfSaveOptions saveOptions = new PdfSaveOptions();

// Enable additional text positioning
saveOptions.setAdditionalTextPositioning(true);

// Save the document as DOCX
pdfDocument.save("output.docx", saveOptions);

Next Steps

  1. Test the conversion with the updated settings and verify if the alignment issues are resolved.
  2. If problems persist, provide a sample PDF file for further analysis.
  3. Review the Aspose documentation for any additional options that may be relevant to your specific case.

Please let me know if you need further assistance!

I have one more question for my current account we have OEM license . So what ASPose.TOTAL version we can use

@TrigynGMS

You may open your license file using any text editor to view its expiry date. The license is valid for use with any version of the API released prior to this expiration date.

1 Like

I was not able to find the setAdditionalTextPositioning method for PdfSaveOptions in 20.10.0.0 for .NET. So still the above mentioned issue is not resolved .Can you please direct me correctly

@TrigynGMS

The Class is part of Aspose.Words API. We are sorry for the confusion. Can you please share your sample code snippet and sample PDF file for our reference? We will test the scenario in our environment and address it accordingly.