Learn how to Convert PDF to Word using Java
The following topics are covered here:
- Convert PDF to Word using Java
- Convert Specific Pages of PDF to Word using Java
- Load Pasword Protected PDF and Convert to Word using Java
Learn how to Convert PDF to Word using Java
The following topics are covered here:
// create converter | |
Converter converter = new Converter("C:\\Files\\sample.pdf"); | |
// set Word convert options | |
WordProcessingConvertOptions options = new WordProcessingConvertOptions(); | |
options.setPageNumber(1); | |
options.setPagesCount(1); | |
options.setFormat(WordProcessingFileType.Docx); | |
// convert | |
converter.convert("C:\\Files\\output.docx", options); |
// PDF load options | |
PdfLoadOptions loadOptions = new PdfLoadOptions(); | |
loadOptions.setPassword("password"); | |
// create converter | |
Converter converter = new Converter("C:\\Files\\sample.pdf", loadOptions); | |
// define Word convert options | |
WordProcessingConvertOptions options = new WordProcessingConvertOptions(); | |
// convert | |
converter.convert("C:\\Files\\output.docx", options); |
// create converter | |
Converter converter = new Converter("C:\\Files\\sample.pdf"); | |
// define Word convert options | |
WordProcessingConvertOptions options = new WordProcessingConvertOptions(); | |
options.setPages(Arrays.asList(2, 3)); | |
// convert | |
converter.convert("C:\\Files\\output.docx", options); |
// create converter | |
Converter converter = new Converter("C:\\Files\\sample.pdf"); | |
// set Word convert options | |
WordProcessingConvertOptions options = new WordProcessingConvertOptions(); | |
options.setFormat(WordProcessingFileType.Docx); | |
// convert | |
converter.convert("C:\\Files\\output.docx", options); |