Skip to content

Commit 6c2ee82

Browse files
committed
upgraded dependencies
1 parent 94b0b6e commit 6c2ee82

3 files changed

Lines changed: 19 additions & 14 deletions

File tree

doctopdf/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@
2525
<dependency>
2626
<groupId>org.apache.poi</groupId>
2727
<artifactId>poi</artifactId>
28-
<version>3.12</version>
28+
<version>3.17</version>
2929
</dependency>
3030

3131
<dependency>
3232
<groupId>org.apache.poi</groupId>
3333
<artifactId>poi-ooxml</artifactId>
34-
<version>3.12</version>
34+
<version>3.17</version>
3535
</dependency>
3636

3737
<dependency>
3838
<groupId>fr.opensagres.xdocreport</groupId>
39-
<artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
40-
<version>1.0.5</version>
39+
<artifactId>fr.opensagres.xdocreport.converter</artifactId>
40+
<version>2.0.1</version>
4141
</dependency>
4242

4343
<dependency>
4444
<groupId>org.apache.poi</groupId>
4545
<artifactId>poi-scratchpad</artifactId>
46-
<version>3.12</version>
46+
<version>3.17</version>
4747
</dependency>
4848

4949
<dependency>

doctopdf/src/main/java/com/doctopdf/App.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
public class App {
1212
public static void main(String[] args) throws Exception {
1313

14-
String inPath = "C:\\Users\\ankur.singhal\\Desktop\\testing\\Keshav-Resume.docx";
14+
String inPath = "C:\\Users\\ankur.singhal\\Desktop\\testing\\AOPT_Payment_Plan_Addendum_12-10-2017.doc";
1515
String lowerCaseInPath = inPath.toLowerCase();
1616

1717
InputStream inStream = getInFileStream(inPath);
18-
OutputStream outStream = getOutFileStream("C:\\Users\\ankur.singhal\\Desktop\\testing\\Keshav-Resume.pdf");
18+
OutputStream outStream = getOutFileStream(
19+
"C:\\Users\\ankur.singhal\\Desktop\\testing\\AOPT_Payment_Plan_Addendum_12-10-2017.pdf");
1920

2021
if (lowerCaseInPath.endsWith("doc")) {
2122
DocToPDFConverter.DocToPDFConvert(inStream, outStream);

doctopdf/src/main/java/com/doctopdf/DocxToPDFConverter.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
import java.io.InputStream;
55
import java.io.OutputStream;
66

7-
import org.apache.poi.xwpf.converter.pdf.PdfConverter;
8-
import org.apache.poi.xwpf.converter.pdf.PdfOptions;
9-
import org.apache.poi.xwpf.usermodel.XWPFDocument;
7+
import fr.opensagres.xdocreport.converter.ConverterRegistry;
8+
import fr.opensagres.xdocreport.converter.ConverterTypeTo;
9+
import fr.opensagres.xdocreport.converter.IConverter;
10+
import fr.opensagres.xdocreport.converter.Options;
11+
import fr.opensagres.xdocreport.converter.XDocConverterException;
1012

1113
public class DocxToPDFConverter {
1214

13-
public static void DocxToPDFConvert(InputStream inStream, OutputStream outStream) throws IOException {
15+
public static void DocxToPDFConvert(InputStream inStream, OutputStream outStream)
16+
throws IOException, XDocConverterException {
1417

15-
XWPFDocument document = new XWPFDocument(inStream);
16-
PdfOptions options = PdfOptions.create();
17-
PdfConverter.getInstance().convert(document, outStream, options);
18+
Options options = Options.getTo(ConverterTypeTo.PDF);
19+
IConverter converter = ConverterRegistry.getRegistry().getConverter(options);
20+
21+
converter.convert(inStream, outStream, options);
1822
}
1923
}

0 commit comments

Comments
 (0)