Convert PDF to Word in Java

The article demonstrates how to convert PDF documents to Word (.doc and .docx) documents using Spire.PDF for Java with a few lines of code.

The sample PDF file looks like the one below.

Convert PDF to Word in Java

Entire Code

import com.spire.pdf.*;

public class PdfToDoc {

    public static void main(String[] args) {

        //create a PdfDocument object
        PdfDocument doc = new PdfDocument();

        //load a sample PDF file
        doc.loadFromFile("C:\\Users\\Administrator\\Desktop\\Introduction of Spire.PDF for Java.pdf");

        //save as .doc file

        //save as. docx file


Convert PDF to Word in Java