Sfoglia il codice sorgente

updating libraries

Jhonny Mertz 5 anni fa
parent
commit
e2a5cdd873

+ 2 - 2
README.md

@@ -16,7 +16,7 @@ If you are using Gradle/Maven, see example below:
 In your `build.gradle`:
 ```groovy
 dependencies {
-    compile 'com.github.jhonnymertz:java-wkhtmltopdf-wrapper:1.1.10-RELEASE'
+    compile 'com.github.jhonnymertz:java-wkhtmltopdf-wrapper:1.1.11-RELEASE'
 }
 ```
 
@@ -26,7 +26,7 @@ In your `pom.xml`:
 <dependency>
     <groupId>com.github.jhonnymertz</groupId>
     <artifactId>java-wkhtmltopdf-wrapper</artifactId>
-    <version>1.1.10-RELEASE</version>
+    <version>1.1.11-RELEASE</version>
 </dependency>
 ```
 

+ 4 - 3
pom.xml

@@ -43,13 +43,13 @@
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
-            <version>3.4</version>
+            <version>3.9</version>
         </dependency>
 
         <dependency>
             <groupId>commons-io</groupId>
             <artifactId>commons-io</artifactId>
-            <version>2.5</version>
+            <version>2.6</version>
         </dependency>
 
         <dependency>
@@ -75,7 +75,7 @@
         <dependency>
             <groupId>org.apache.pdfbox</groupId>
             <artifactId>pdfbox</artifactId>
-            <version>2.0.15</version>
+            <version>2.0.16</version>
             <scope>test</scope>
         </dependency>
 
@@ -93,6 +93,7 @@
                     <!-- Show 100% of the lines from the stack trace (doesn't work) -->
                     <trimStackTrace>false</trimStackTrace>
                 </configuration>
+                <version>2.22.1</version>
                 <executions>
                     <execution>
                         <id>unit-tests</id>

+ 5 - 14
src/test/java/com/github/jhonnymertz/wkhtmltopdf/wrapper/integration/PdfIntegrationTests.java

@@ -6,7 +6,7 @@ import com.github.jhonnymertz.wkhtmltopdf.wrapper.configurations.XvfbConfig;
 import com.github.jhonnymertz.wkhtmltopdf.wrapper.params.Param;
 import org.apache.pdfbox.pdfparser.PDFParser;
 import org.apache.pdfbox.pdmodel.PDDocument;
-import org.apache.pdfbox.util.PDFTextStripper;
+import org.apache.pdfbox.text.PDFTextStripper;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -89,13 +89,9 @@ public class PdfIntegrationTests {
     }
 
     private String getPdfTextFromBytes(byte[] pdfBytes) throws IOException {
-        PDFParser parser = new PDFParser(new ByteArrayInputStream(pdfBytes));
+        PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(pdfBytes));
+        String text = new PDFTextStripper().getText(pdDocument);
 
-        // that is a valid PDF (otherwise an IOException occurs)
-        parser.parse();
-        PDFTextStripper pdfTextStripper = new PDFTextStripper();
-        PDDocument pdDocument = new PDDocument(parser.getDocument());
-        String text = pdfTextStripper.getText(pdDocument);
         pdDocument.close();
         return text;
     }
@@ -128,13 +124,8 @@ public class PdfIntegrationTests {
 
         // WHEN
         byte[] pdfBytes = pdf.getPDF();
-
-        PDFParser parser = new PDFParser(new ByteArrayInputStream(pdfBytes));
-
-        // that is a valid PDF (otherwise an IOException occurs)
-        parser.parse();
-        PDFTextStripper pdfTextStripper = new PDFTextStripper();
-        String pdfText = pdfTextStripper.getText(new PDDocument(parser.getDocument()));
+        PDDocument pdDocument = PDDocument.load(new ByteArrayInputStream(pdfBytes));
+        String pdfText = new PDFTextStripper().getText(pdDocument);
 
         Assert.assertThat("document should be generated", pdfText, containsString("Google"));
     }