How to Convert PDF to Editable Word Document in Java?

I have been attempting to implement your Java Pdf Cloud API. I attempted to download your SDK at GitHub - aspose-pdf-cloud/aspose-pdf-cloud-java: Java library for communicating with the Aspose.PDF Cloud API and implement in my IntelliJ project but your SDK project is showing up with 100 errors. They all have the same message: java: illegal character: \65279.


Is there something special I need to do to implement cloud sdk for Java in an IntelliJ project?

Hi there,


We are sorry for the inconvenience. Can you please provide some more details about the issue? We will appreciate if you please confirm the feature you are implementing and more details about the error message.

Best Regards,

@zmacomber

We have tested Aspose.PDF Cloud SDK for Java to convert PDF to editable Word document in Java in IntelliJ Idea IDE and are unable to notice any issue.

Please try the latest Aspose.PDF Cloud SDK for Java. Now you can use it conveniently via Maven or Gradle without any issue. Please check the following steps to use Aspose.PDF Cloud SDK for Java. You may also check the installation section of the Aspose.PDF Cloud SDK for Java readme file for details.

Steps to Convert PDF to Word Editable in Java

  1. Sign up with aspose.cloud and get the credentials
  2. Create a Maven project in IntelliJ Idea IDE and install Aspose.PDF Cloud SDK for Java from the Maven repository
  3. Upload the the PDF to cloud storage
  4. Initialize Aspose.PDF Cloud API
  5. Convert PDF to DOCX using getPdfInStorageToDoc API method
  6. Save output DOCX document to local drive

Code to Convert PDF to Word Editable in Java

import com.aspose.asposecloudpdf.ApiClient;
import com.aspose.asposecloudpdf.ApiException;
import com.aspose.asposecloudpdf.api.PdfApi;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

public class ConvertPDFtoDOCXJavaExample {
    public static void main(String[] args) throws ApiException, IOException {
        //TODO: Get your ClientId and Client Secret at https://dashboard.aspose.cloud (free registration is required)
        ApiClient apiClient = new ApiClient();
        apiClient.setAppKey("xxxxxxxxxxxxxxxxxxxxxxxxx");
        apiClient.setAppSid("xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx");

        // Initialize API
        PdfApi pdfApi = new PdfApi(apiClient);
        String name = "Test.pdf";
        String storage = "MyDB_Storage";
        String folder = "Zapier/PDF";
        String format="DocX";

        // Convert a PDF from cloud storage to DOCX 
        File convertPDFtoDOCXJavaResponse = pdfApi.getPdfInStorageToDoc(name, null, format, null, null, null, null, null, null, folder, storage);
        //Download Merge PDF file from Cloud Storage
        File dest = new File("C:/Temp/Test_PDF.docx");
        Files.copy(convertPDFtoDOCXJavaResponse.toPath(), dest.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
        System.out.println("completed......");
    }
}