Merge pull request #15183 from panos-kakos/JAVA-26715

[JAVA-26715] Upgraded pdfbox to latest version
This commit is contained in:
Alvin Austria 2023-11-17 02:26:18 +01:00 committed by GitHub
commit df1e164270
4 changed files with 26 additions and 22 deletions

View File

@ -51,7 +51,7 @@
<itextpdf.version>5.5.13.3</itextpdf.version>
<itextpdf.core.version>7.2.3</itextpdf.core.version>
<itextpdf.cleanup.version>3.0.1</itextpdf.cleanup.version>
<pdfbox.version>3.0.0-RC1</pdfbox.version>
<pdfbox.version>3.0.0</pdfbox.version>
</properties>
</project>

View File

@ -1,29 +1,31 @@
package com.baeldung.pdfinfo;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import java.io.IOException;
import java.util.Map;
public class PdfInfoITextUnitTest {
import org.junit.jupiter.api.Test;
class PdfInfoITextUnitTest {
private static final String PDF_FILE = "src/test/resources/input.pdf";
@Test
public void givenPdf_whenGetNumberOfPages_thenOK() throws IOException {
Assert.assertEquals(4, PdfInfoIText.getNumberOfPages(PDF_FILE));
void givenPdf_whenGetNumberOfPages_thenOK() throws IOException {
assertEquals(4, PdfInfoIText.getNumberOfPages(PDF_FILE));
}
@Test
public void givenPdf_whenIsPasswordRequired_thenOK() throws IOException {
Assert.assertFalse(PdfInfoIText.isPasswordRequired(PDF_FILE));
void givenPdf_whenIsPasswordRequired_thenOK() throws IOException {
assertFalse(PdfInfoIText.isPasswordRequired(PDF_FILE));
}
@Test
public void givenPdf_whenGetInfo_thenOK() throws IOException {
void givenPdf_whenGetInfo_thenOK() throws IOException {
Map<String, String> info = PdfInfoIText.getInfo(PDF_FILE);
Assert.assertEquals("LibreOffice 4.2", info.get("Producer"));
Assert.assertEquals("Writer", info.get("Creator"));
assertEquals("LibreOffice 4.2", info.get("Producer"));
assertEquals("Writer", info.get("Creator"));
}
}

View File

@ -1,29 +1,31 @@
package com.baeldung.pdfinfo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import java.io.IOException;
public class PdfInfoPdfBoxUnitTest {
class PdfInfoPdfBoxUnitTest {
private static final String PDF_FILE = "src/test/resources/input.pdf";
@Test
public void givenPdf_whenGetNumberOfPages_thenOK() throws IOException {
Assert.assertEquals(4, PdfInfoPdfBox.getNumberOfPages(PDF_FILE));
void givenPdf_whenGetNumberOfPages_thenOK() throws IOException {
assertEquals(4, PdfInfoPdfBox.getNumberOfPages(PDF_FILE));
}
@Test
public void givenPdf_whenIsPasswordRequired_thenOK() throws IOException {
Assert.assertFalse(PdfInfoPdfBox.isPasswordRequired(PDF_FILE));
void givenPdf_whenIsPasswordRequired_thenOK() throws IOException {
assertFalse(PdfInfoPdfBox.isPasswordRequired(PDF_FILE));
}
@Test
public void givenPdf_whenGetInfo_thenOK() throws IOException {
void givenPdf_whenGetInfo_thenOK() throws IOException {
PDDocumentInformation info = PdfInfoPdfBox.getInfo(PDF_FILE);
Assert.assertEquals("LibreOffice 4.2", info.getProducer());
Assert.assertEquals("Writer", info.getCreator());
assertEquals("LibreOffice 4.2", info.getProducer());
assertEquals("Writer", info.getCreator());
}
}

View File

@ -104,7 +104,7 @@
</build>
<properties>
<pdfbox-tools.version>2.0.25</pdfbox-tools.version>
<pdfbox-tools.version>3.0.0</pdfbox-tools.version>
<pdf2dom.version>2.0.1</pdf2dom.version>
<itextpdf.version>5.5.13.3</itextpdf.version>
<xmlworker.version>5.5.10</xmlworker.version>