diff --git a/NOTICE b/NOTICE index 3d1d07f..d5eacc0 100644 --- a/NOTICE +++ b/NOTICE @@ -1,6 +1,6 @@ Digipost Printability Validator -Copyright 2023 Posten Norge AS. All Rights Reserved. +Copyright 2024 Posten Norge AS. All Rights Reserved. This product includes software developed by Posten Norge AS. - https://www.posten.no/ Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html @@ -8,8 +8,10 @@ Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html This software includes third party software subject to the following licenses: - Apache FontBox under Apache License, Version 2.0 - Apache PDFBox under Apache License, Version 2.0 + Apache Commons Logging under The Apache Software License, Version 2.0 + Apache FontBox under Apache-2.0 + Apache PDFBox under Apache-2.0 + Apache PDFBox io under Apache-2.0 Digipost Printability Validator under The Apache Software License, Version 2.0 JCL 1.2 implemented over SLF4J under Apache License, Version 2.0 SLF4J API Module under MIT License diff --git a/pom.xml b/pom.xml index 661e9b7..3cf62ec 100644 --- a/pom.xml +++ b/pom.xml @@ -33,7 +33,7 @@ 1.8 1.8 - 2.0.9 + 2.0.10 @@ -57,7 +57,18 @@ org.apache.pdfbox pdfbox - 2.0.27 + 3.0.1 + + + commons-logging + commons-logging + + + + + org.apache.pdfbox + pdfbox-io + 3.0.1 commons-logging @@ -219,7 +230,8 @@ org.slf4j org.apache.commons:commons-lang3 org.hamcrest - org.junit.jupiter:junit-jupiter-api + org.junit.jupiter:* + org.junit.platform:* org.opentest4j:opentest4j org.apiguardian:apiguardian-api org.junit.platform:junit-platform-commons diff --git a/src/NOTICE.template b/src/NOTICE.template index da888f1..a56278c 100644 --- a/src/NOTICE.template +++ b/src/NOTICE.template @@ -1,6 +1,6 @@ Digipost Printability Validator -Copyright 2023 Posten Norge AS. All Rights Reserved. +Copyright 2024 Posten Norge AS. All Rights Reserved. This product includes software developed by Posten Norge AS. - https://www.posten.no/ Licensed under Apache 2 - http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/src/main/java/no/digipost/print/validate/PdfValidator.java b/src/main/java/no/digipost/print/validate/PdfValidator.java index 04d7216..cb5054f 100644 --- a/src/main/java/no/digipost/print/validate/PdfValidator.java +++ b/src/main/java/no/digipost/print/validate/PdfValidator.java @@ -16,6 +16,9 @@ package no.digipost.print.validate; import no.digipost.print.validate.PdfValidationSettings.Bleed; +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.io.RandomAccessInputStream; +import org.apache.pdfbox.io.RandomAccessReadBuffer; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.common.PDRectangle; @@ -85,7 +88,7 @@ public PdfValidationResult validate(Path pdfFile, PdfValidationSettings printVal private PdfValidationResult validateForPrint(InputStream pdfStream, PdfValidationSettings printValidationSettings) { int numberOfPages = -1; List errors; - try (PDDocument pdDoc = PDDocument.load(pdfStream)) { + try (PDDocument pdDoc = Loader.loadPDF(new RandomAccessReadBuffer(pdfStream))) { numberOfPages = pdDoc.getNumberOfPages(); errors = validateDocumentForPrint(pdDoc, printValidationSettings); } catch (InvalidPasswordException invalidPassword) { @@ -195,7 +198,7 @@ private void validerSideantall(int numberOfPages, int maxPages, final List 0) { + if (text != null && !text.trim().isEmpty()) { hasTextInArea = true; } return hasTextInArea;