Convert PDF to DOCX using Java

Aspose PDF for java 21.12 version is producing docx files which on editing messes up the character spacing and line spacing when content is within a list.

API code used

public static void ConvertPDFtoWordDocAdvanced()
{ 
    Path pdfFile = Paths.get(_dataDir.toString(), "Sample-Report.pdf");
    Path docFile = Paths.get(_dataDir.toString(), "Sample-Report.docx");
    Document pdfDocument = new Document(pdfFile.toString());        
    DocSaveOptions saveOptions = new DocSaveOptions();
    
    // Specify the output format as DOC
    saveOptions.setFormat(DocSaveOptions.DocFormat.Docx);
    // Set the recognition mode as Flow
    saveOptions.setMode(DocSaveOptions.RecognitionMode.Flow);
   
    
    // Enable the value to recognize bullets during conversion process
    saveOptions.setRecognizeBullets(true);

    pdfDocument.save(docFile.toString(), saveOptions);
}

Attached sample pdf and output word document generated.

Sample-Report.pdf (333.7 KB)
Sample-Report.docx (4.5 MB)

1 Like

@Nithu

We were able to replicate the similar issue while converting your PDF to DOCX using Aspose.PDF for Java 22.1. Therefore, it has been logged as PDFJAVA-41331 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Team,
Could we get an update on this issue?

@Nithu

The ticket has recently been logged in our issue management system and we are afraid that it is not yet resolved. Please note that we will investigate and resolve it on a first come first serve basis and let you know once we have definite updates regarding its resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi,

We are from Thomson Reuters and there is Paid support subscription tie up with ASPOSE, can you please look into options to expedite in fixing above issue.

@Nithu

In case you have paid support subscription, you need to create a post in respective support forum with the reference of ticket ID. The issue will be expediated to the highest priority then.