Skip to content

Commit

Permalink
updating libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonnymertz committed Jul 5, 2019
1 parent ea6c72b commit e2a5cdd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
```

Expand All @@ -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>
```

Expand Down
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>

Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
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;

Expand Down Expand Up @@ -89,13 +89,9 @@ public void testRemovingGeneratedFile() throws Exception {
}

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;
}
Expand Down Expand Up @@ -128,13 +124,8 @@ public void testPdfWithXvfb() throws Exception {

// 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"));
}
Expand Down

0 comments on commit e2a5cdd

Please sign in to comment.