Home > Back-end >  How to use JAVA programming implementation, PDF file into Word file (. Doc or. Docx) file
How to use JAVA programming implementation, PDF file into Word file (. Doc or. Docx) file

Time:09-30

Imagination today, suddenly want to write a JAVA program to PDF file into Word file (can be. Doc or. Docx file suffix), suffer from have no idea, so please master Pointers ha,
If it's just use the pdfbox libraries PDF files can be converted into word file? If not, could you tell me what kind of class library? And roughly how to write?
Thinking, if you can attach a key code, the grateful huh? Is willing to chat to 60 points table thanks!

CodePudding user response:

Import the Java. IO. The File;
Import the Java. IO. FileOutputStream;
import java.io.IOException;
Import the Java. IO. OutputStreamWriter;
Import the Java. IO. Writer;

The import org. Apache. Pdfbox. Pdmodel. PDDocument;
The import org. Apache. Pdfbox. Text. PDFTextStripper;

Public class TestPDFBox {

Public static void main (String [] args) throws IOException {
File File=new File (" D: \ \ AppTestData \ \ receive case in section 1 (2). PDF ");
PDDocument doc=PDDocument. Load (file);
Int pagenumber=doc. GetNumberOfPages ();
System. The out. Print (" pages "+ pagenumber);
FileOutputStream fos=new FileOutputStream (" D: \ \ AppTestData \ \ receive case in section 1 (2). Doc ");
Writer Writer=new OutputStreamWriter (fos, "utf-8");
PDFTextStripper stripper=new PDFTextStripper ();
Stripper. SetSortByPosition (true);//order
Stripper. SetStartPage (3);//set the start of the conversion page
Stripper. SetEndPage (7);//set the end of the conversion page
Stripper. WriteText (doc, writer);
Writer. The close ();
Doc. The close ();
}
}

CodePudding user response:

Scan version not sure... B: well... Is not absolutely not ha ha ha ha ha
The text version.. There are some tools to do such a thing can read come in when the flow is also great...

CodePudding user response:

Tables, pictures, directory is turned about

CodePudding user response:

If I remember correctly is can use openoffice concrete examples should have online time is too long a little can't remember

CodePudding user response:

The input stream, building in the PDF output stream, built on the word,
I am too intelligent

CodePudding user response:

Free version of the software document file format conversion, the perfect support word doc docx WPS execl form image conversion

PDF is converted into word converter http://www.downza.cn/soft/266336.html


Word to PDF converter http://www.downza.cn/soft/215618.html

CodePudding user response:

Refer to
https://stackoverflow.com/questions/17986305/how-can-i-convert-pdf-file-to-word-file-using-java

CodePudding user response:

Use of Jacob can realize Word, execl, TXT all files into PDF, but require the latest versions of Microsoft office software

CodePudding user response:

We can use the Spire. PDF for Java to PDF file into Word file,

PDF to Word code examples:

//load PDF
PdfDocument PDF=new PdfDocument ();
PDF. LoadFromFile (" Input. PDF ");
//save as Word format
PDF. SaveToFile (" ToWord. Docx, FileFormat. Docx);

CodePudding user response:

  • Related