Skip to content

Commit

Permalink
Update pdfbox to 3.0.* (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessieAMorris authored Dec 17, 2024
1 parent e86c538 commit ab0c806
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ai.philterd.services.pdf.model.RedactedRectangle;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
Expand Down Expand Up @@ -83,8 +84,7 @@ public PdfRedacter(Policy policy,

@Override
public byte[] process(byte[] document, MimeType outputMimeType) throws IOException {

final PDDocument pdDocument = PDDocument.load(document);
final PDDocument pdDocument = Loader.loadPDF(document);

setSortByPosition(true);
setStartPage(0);
Expand Down Expand Up @@ -209,7 +209,7 @@ protected void endDocument(PDDocument doc) throws IOException {
for(int pageNumber : rectangles.keySet()) {

final PDPage page = document.getPage(pageNumber);
final PDPageContentStream contentStream = new PDPageContentStream(doc, page, true, true, true);
final PDPageContentStream contentStream = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, true, true);

for(final RedactedRectangle rectangle : rectangles.get(pageNumber)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.text.PDFTextStripper;
import org.apache.pdfbox.text.TextPosition;

Expand All @@ -45,7 +46,7 @@ public PdfTextExtractor() throws IOException {
@Override
public List<String> getLines(byte[] document) throws IOException {

final PDDocument pdDocument = PDDocument.load(document);
final PDDocument pdDocument = Loader.loadPDF(document);

this.setSortByPosition(true);
this.setStartPage(0);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<mockito.version>5.14.2</mockito.version>
<nv-i18n.version>1.27</nv-i18n.version>
<opennlp.version>2.5.0</opennlp.version>
<pdfbox.version>2.0.23</pdfbox.version>
<pdfbox.version>3.0.3</pdfbox.version>
<redis-mock.version>0.1.6</redis-mock.version>
<redisson.version>3.39.0</redisson.version>
<retrofit.version>2.11.0</retrofit.version>
Expand Down

0 comments on commit ab0c806

Please sign in to comment.