From 15a169b36031aa55445b3432ed4f1a0a7f96230a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 16 Dec 2023 17:18:10 +0100 Subject: [PATCH] chore(deps): bump org.apache.pdfbox:pdfbox in /cie-java (#87) Bumps org.apache.pdfbox:pdfbox from 2.0.29 to 3.0.1. --- updated-dependencies: - dependency-name: org.apache.pdfbox:pdfbox dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- cie-java/build.gradle | 2 +- cie-java/src/it/ipzs/cieid/Firma/PdfPreview.java | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/cie-java/build.gradle b/cie-java/build.gradle index d1f49a4d..7dbf96b4 100644 --- a/cie-java/build.gradle +++ b/cie-java/build.gradle @@ -33,7 +33,7 @@ dependencies { implementation 'commons-io:commons-io:2.15.1' implementation 'com.google.code.gson:gson:2.10.1' implementation 'net.java.dev.jna:jna:5.14.0' - implementation 'org.apache.pdfbox:pdfbox:2.0.29' + implementation 'org.apache.pdfbox:pdfbox:3.0.1' } mainClassName = 'it.ipzs.cieid.MainApplicationn' diff --git a/cie-java/src/it/ipzs/cieid/Firma/PdfPreview.java b/cie-java/src/it/ipzs/cieid/Firma/PdfPreview.java index 0414ac9b..69df590a 100644 --- a/cie-java/src/it/ipzs/cieid/Firma/PdfPreview.java +++ b/cie-java/src/it/ipzs/cieid/Firma/PdfPreview.java @@ -2,11 +2,12 @@ import java.awt.*; import java.awt.image.BufferedImage; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.swing.*; +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.io.RandomAccessReadBufferedFile; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.rendering.PDFRenderer; @@ -36,10 +37,8 @@ public PdfPreview(JPanel panelPdfPreview, String pdfFilePath, String signImagePa imgPanel.add(signImage); imgPanel.add(imgLabel); - File file = new File(filePath); - try { - PDDocument document = PDDocument.load(file); + PDDocument document = Loader.loadPDF(new RandomAccessReadBufferedFile(filePath)); pdfNumPages = document.getNumberOfPages(); System.out.println("Pdf page: " + pdfNumPages); PDFRenderer renderer = new PDFRenderer(document);