Fixes to PDF module (#807)

* PDF to X

* PDF to X

* Remove created doc

* Code fixes and cleanup for PDF module

* Fix web.xml in spring-mvc-web-vs-initializer project

* Rollback web.xml

* Fixes to PDF article
This commit is contained in:
maibin 2016-11-05 22:07:52 +01:00 committed by Grzegorz Piwowarek
parent c29601db41
commit 04d33298ac
3 changed files with 23 additions and 49 deletions

View File

@ -24,49 +24,31 @@
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox-tools -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox-tools</artifactId>
<version>2.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.cssbox/pdf2dom -->
<dependency>
<groupId>net.sf.cssbox</groupId>
<artifactId>pdf2dom</artifactId>
<version>1.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.itextpdf/itextpdf -->
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-transcoder -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-transcoder</artifactId>

View File

@ -23,7 +23,6 @@ public class PDF2HTMLExample {
}
private static void generateHTMLFromPDF(String filename) throws ParserConfigurationException, IOException {
try {
PDDocument pdf = PDDocument.load(new File(filename));
PDFDomTree parser = new PDFDomTree();
Writer output = new PrintWriter("src/output/pdf.html", "utf-8");
@ -32,8 +31,5 @@ public class PDF2HTMLExample {
if (pdf != null) {
pdf.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -23,7 +23,6 @@ public class PDF2TextExample {
}
private static void generateTxtFromPDF(String filename) throws IOException {
try {
File f = new File(filename);
String parsedText;
PDFParser parser = new PDFParser(new RandomAccessFile(f, "r"));
@ -44,9 +43,6 @@ public class PDF2TextExample {
PrintWriter pw = new PrintWriter("src/output/pdf.txt");
pw.print(parsedText);
pw.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}