From ad3722eeda59cb2bcffa205f6ad8fbb37cf55504 Mon Sep 17 00:00:00 2001 From: emusic Date: Wed, 21 Mar 2018 16:56:28 +0100 Subject: solved bug resource not found --- .../gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pdf-as-pdfbox-2/src/main/java') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java index 4f229874..0398e75b 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PADESPDFBOXSigner.java @@ -69,6 +69,7 @@ import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructur import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; import org.apache.pdfbox.pdmodel.encryption.AccessPermission; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; +import org.apache.pdfbox.pdmodel.graphics.image.JPEGFactory; import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions; @@ -331,9 +332,10 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { // Placeholder found! // replace placeholder - URL fileUrl = PADESPDFBOXSigner.class.getResource("/placeholder/empty.jpg"); - PDImageXObject img = PDImageXObject.createFromFile(fileUrl.getPath(), doc); + InputStream fis = PADESPDFBOXSigner.class.getResourceAsStream("/placeholder/empty.jpg"); + PDImageXObject img = JPEGFactory.createFromStream(doc, fis); + img.getCOSObject().setNeedToBeUpdated(true); // PDDocumentCatalog root = doc.getDocumentCatalog(); -- cgit v1.2.3