diff options
| author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2026-04-15 13:49:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-15 13:49:22 +0200 |
| commit | 77dd3fcc4d85088b15ab859c4438521d9cd6ed10 (patch) | |
| tree | aefedc8d2ef77e6819b46a948459d6016dfe5b62 /pdf-as-pdfbox-2/src/main/java | |
| parent | 88930540361a88ff56e07fed31004b583f2e729f (diff) | |
| download | pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.gz pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.bz2 pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.zip | |
pdf-as-5 (#82)
- JDK 17
- PDFBox 3
- PDF-AS Web moved to Spring Boot
- MOA Integration tests w/ new error code
---------
Co-authored-by: Gerald Palfinger <gerald.palfinger@a-sit.at>
Co-authored-by: kathrin.resek <kathrin.resek@a-sit.at>
Diffstat (limited to 'pdf-as-pdfbox-2/src/main/java')
34 files changed, 205 insertions, 401 deletions
diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/PDFBOXObject.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/PDFBOXObject.java index 53b87d86..e0947b46 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/PDFBOXObject.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/PDFBOXObject.java @@ -2,7 +2,7 @@ package at.gv.egiz.pdfas.lib.impl.pdfbox2; import java.io.IOException; -import javax.activation.DataSource; +import jakarta.activation.DataSource; import org.apache.pdfbox.pdmodel.PDDocument; @@ -28,21 +28,15 @@ public class PDFBOXObject extends PDFObject { super(operationStatus); } - @Override - protected void finalize() throws Throwable { - super.finalize(); - if(doc != null) { - doc.close(); - } - } + // Note: finalize() method removed as it's deprecated in Java 9+ + // Resource cleanup should be handled explicitly via close() method public void close() { if(doc != null) { try { doc.close(); - //System.gc(); } catch(Throwable e) { - // ignore! + // Ignore Throwables during close } doc = null; } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java index ee828705..97b6b66e 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/configuration/ProfileValidator.java @@ -52,7 +52,7 @@ public class ProfileValidator implements ConfigurationValidator{ ArrayList<SignatureProfileSettings> profileSettings = new ArrayList<SignatureProfileSettings>(); - OperationStatus opState = new OperationStatus(settings, null, null); + OperationStatus opState = new OperationStatus(settings, null, null, null); X509Certificate dummyCert = new X509Certificate(); dummyCert.setSerialNumber(new BigInteger("123")); diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/PDFBoxPlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/PDFBoxPlaceholderExtractor.java index ad874bc0..414b8a31 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/PDFBoxPlaceholderExtractor.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/PDFBoxPlaceholderExtractor.java @@ -1,6 +1,7 @@ package at.gv.egiz.pdfas.lib.impl.pdfbox2.placeholder; import java.io.IOException; +import java.lang.reflect.InvocationTargetException; import at.gv.egiz.pdfas.common.exceptions.PDFIOException; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; @@ -14,12 +15,12 @@ public class PDFBoxPlaceholderExtractor implements PlaceholderExtractor { @Override public SignaturePlaceholderData extract(PDFObject doc, String placeholderId, int matchMode) throws PdfAsException { - if (doc instanceof PDFBOXObject) { - PDFBOXObject object = (PDFBOXObject) doc; - try { + if (doc instanceof PDFBOXObject object) { + try { SignaturePlaceholderExtractor extractor = new SignaturePlaceholderExtractor(); return extractor.extract(object.getDocument(), placeholderId, matchMode); - } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e2) { + } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | + InvocationTargetException e2) { throw new PDFIOException("error.pdf.io.04", e2); } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java index 0b148551..d90f02a1 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/placeholder/SignaturePlaceholderExtractor.java @@ -50,16 +50,10 @@ import java.awt.geom.AffineTransform; import java.awt.geom.NoninvertibleTransformException; import java.awt.image.BufferedImage; import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; +import java.lang.reflect.InvocationTargetException; +import java.util.*; import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; import java.util.Map.Entry; -import java.util.Objects; -import java.util.Properties; -import java.util.Set; -import java.util.Vector; import java.util.stream.Collectors; import org.apache.pdfbox.contentstream.PDFStreamEngine; @@ -112,7 +106,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl private int currentPage = 0; protected SignaturePlaceholderExtractor() throws IOException, ClassNotFoundException, - InstantiationException, IllegalAccessException { + InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { super(); final Properties properties = new Properties(); @@ -124,7 +118,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl final String processorClassName = (String) entry.getValue(); final Class<?> klass = Class.forName(processorClassName); final org.apache.pdfbox.contentstream.operator.OperatorProcessor processor = - (OperatorProcessor) klass.newInstance(); + (OperatorProcessor) klass.getDeclaredConstructor().newInstance(); addOperator(processor); @@ -198,17 +192,14 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine implements Pl rotation.setToRotation(rotationInRadians); final AffineTransform rotationInverse = rotation .createInverse(); - final Matrix rotationInverseMatrix = new Matrix(); - rotationInverseMatrix - .setFromAffineTransform(rotationInverse); - final Matrix rotationMatrix = new Matrix(); - rotationMatrix.setFromAffineTransform(rotation); + final Matrix rotationInverseMatrix = new Matrix(rotationInverse); + final Matrix rotationMatrix = new Matrix(rotation); final Matrix unrotatedCTM = ctm .multiply(rotationInverseMatrix); - float x = unrotatedCTM.getXPosition(); - final float yPos = unrotatedCTM.getYPosition(); + float x = unrotatedCTM.getTranslateX(); + final float yPos = unrotatedCTM.getTranslateY(); final float yScale = unrotatedCTM.getScaleY(); float y = yPos + yScale; final float w = unrotatedCTM.getScaleX(); diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java index f9dc62fd..7b18d2f1 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/Positioning.java @@ -49,7 +49,7 @@ import lombok.extern.slf4j.Slf4j; * change this template use File | Settings | File Templates. */ @Slf4j -public class Positioning { +public class Positioning { /** * The left/right margin. 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 d8a25a9a..db899ee8 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 @@ -29,6 +29,8 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; +import java.security.Signature; import java.util.ArrayList; import java.util.Calendar; import java.util.Collections; @@ -36,7 +38,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.activation.DataSource; +import jakarta.activation.DataSource; import org.apache.commons.io.IOUtils; import org.apache.pdfbox.cos.COSArray; @@ -110,29 +112,16 @@ import iaik.x509.X509Certificate; import lombok.extern.slf4j.Slf4j; @Slf4j -public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { +public class PADESPDFBOXSigner implements IPdfSigner<PDFBOXObject, SignatureDataExtractor>, IConfigurationConstants { @Override - public void signPDF(PDFObject genericPdfObject, RequestedSignature requestedSignature, - PDFASSignatureInterface genericSigner) throws PdfAsException { + public void signPDF(PDFBOXObject pdfObject, RequestedSignature requestedSignature, + SignatureDataExtractor signer) throws PdfAsException { boolean isAdobeSigForm = false; - - if (!(genericPdfObject instanceof PDFBOXObject)) { - throw new PdfAsException("PDF to signObject is of wrong type: " + genericPdfObject.getClass().getName()); - - } - - if (!(genericSigner instanceof PDFASPDFBOXSignatureInterface)) { - throw new PdfAsException("PDF signerObject is of wrong type:" + genericSigner.getClass().getName()); - - } - - final PDFBOXObject pdfObject = (PDFBOXObject) genericPdfObject; - final PDFASPDFBOXSignatureInterface signer = (PDFASPDFBOXSignatureInterface) genericSigner; PDDocument doc = null; SignatureOptions options = new SignatureOptions(); @@ -161,7 +150,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { // extract next QR-code placeholder, if exists SignaturePlaceholderData nextPlaceholderData = PlaceholderFilter.checkPlaceholderSignatureLocation( pdfObject.getStatus(), pdfObject.getStatus().getSettings(), - pdfObject.getStatus().getSignParamter().getPlaceHolderId()); + pdfObject.getStatus().getSignParameter().getPlaceHolderId()); if (nextPlaceholderData != null) { log.info("Placeholder data found. Injection placeholderId ..."); @@ -214,7 +203,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { final SignatureProfileConfiguration signatureProfileConfiguration = pdfObject.getStatus().getSignatureProfileConfiguration(requestedSignature.getSignatureProfileID()); final TablePos tablePos = prepareTablePosition(nextPlaceholderData, signatureProfileConfiguration, - pdfObject.getStatus().getSignParamter().getSignaturePosition()); + pdfObject.getStatus().getSignParameter().getSignaturePosition()); final Table main = TableFactory.createSigTable(signatureProfileSettings, MAIN, pdfObject.getStatus(), requestedSignature); @@ -456,13 +445,13 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { final COSDictionary objectDic = new COSDictionary(); objectDic.setName("Type", "OBJR"); - objectDic.setItem("Pg", signatureField.getWidget().getPage()); - objectDic.setItem("Obj", signatureField.getWidget()); + objectDic.setItem("Pg", signatureField.getWidgets().get(0).getPage()); + objectDic.setItem("Obj", signatureField.getWidgets().get(0)); final List<Object> l = new ArrayList<>(); l.add(objectDic); sigBlock.setKids(l); - sigBlock.setPage(signatureField.getWidget().getPage()); + sigBlock.setPage(signatureField.getWidgets().get(0).getPage()); sigBlock.setTitle("Signature Table"); sigBlock.setParent(docElement); @@ -530,13 +519,13 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } // set StructureParent for signature field annotation - signatureField.getWidget().setStructParent(parentTreeNextKey); + signatureField.getWidgets().get(0).setStructParent(parentTreeNextKey); // Increase the next Key value in the structure tree root structureTreeRoot.setParentTreeNextKey(parentTreeNextKey + 1); // add the Tabs /S Element for Tabbing through annots - final PDPage p = signatureField.getWidget().getPage(); + final PDPage p = signatureField.getWidgets().get(0).getPage(); p.getCOSObject().setName("Tabs", "S"); p.getCOSObject().setNeedToBeUpdated(true); @@ -671,7 +660,12 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { PreflightDocument document = null; ValidationResult result = null; try { - final PreflightParser parser = new PreflightParser(signedDocument); + final PreflightParser parser = new PreflightParser(new javax.activation.DataSource() { + @Override public InputStream getInputStream() throws IOException { return signedDocument.getInputStream(); } + @Override public OutputStream getOutputStream() throws IOException { return signedDocument.getOutputStream(); } + @Override public String getContentType() { return signedDocument.getContentType(); } + @Override public String getName() { return signedDocument.getName(); } + }); // // parser.parse(Format.PDF_A1B); parser.parse(); @@ -715,30 +709,18 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { } @Override - public PDFObject buildPDFObject(OperationStatus operationStatus) { + public PDFBOXObject buildPDFObject(OperationStatus operationStatus) { return new PDFBOXObject(operationStatus); } @Override - public PDFASSignatureInterface buildSignaturInterface(IPlainSigner signer, SignParameter parameters, - RequestedSignature requestedSignature) { - return new PdfboxSignerWrapper(signer, parameters, requestedSignature); - } - - @Override - public PDFASSignatureExtractor buildBlindSignaturInterface(X509Certificate certificate, String filter, + public SignatureDataExtractor buildBlindSignaturInterface(X509Certificate certificate, String filter, String subfilter, Calendar date) { return new SignatureDataExtractor(certificate, filter, subfilter, date); } @Override - public void checkPDFPermissions(PDFObject genericPdfObject) throws PdfAsException { - if (!(genericPdfObject instanceof PDFBOXObject)) { - // tODO: - throw new PdfAsException(); - } - - final PDFBOXObject pdfObject = (PDFBOXObject) genericPdfObject; + public void checkPDFPermissions(PDFBOXObject pdfObject) throws PdfAsException { PdfBoxUtils.checkPDFPermissions(pdfObject.getDocument()); } @@ -755,7 +737,7 @@ public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { int resolution, OperationStatus status, RequestedSignature requestedSignature) throws PDFASError { try { - final PDFBOXObject pdfObject = (PDFBOXObject) status.getPdfObject(); + final PDFBOXObject pdfObject = (PDFBOXObject)(PDFBOXObject) status.getPdfObject(); final PDDocument origDoc = new PDDocument(); origDoc.addPage(new PDPage(PDRectangle.A4)); diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXExtractorInterface.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXExtractorInterface.java deleted file mode 100644 index c99e7c59..00000000 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXExtractorInterface.java +++ /dev/null @@ -1,7 +0,0 @@ -package at.gv.egiz.pdfas.lib.impl.signing.pdfbox2; - -import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureExtractor; - -public interface PDFASPDFBOXExtractorInterface extends PDFASSignatureExtractor, PDFASPDFBOXSignatureInterface { - -} diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXSignatureInterface.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXSignatureInterface.java deleted file mode 100644 index cc260ece..00000000 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PDFASPDFBOXSignatureInterface.java +++ /dev/null @@ -1,10 +0,0 @@ -package at.gv.egiz.pdfas.lib.impl.signing.pdfbox2; - -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface; - -import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureInterface; - -public interface PDFASPDFBOXSignatureInterface extends PDFASSignatureInterface, SignatureInterface { - public void setPDSignature(PDSignature signature); -} diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PdfboxSignerWrapper.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PdfboxSignerWrapper.java deleted file mode 100644 index 7aaf1510..00000000 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/PdfboxSignerWrapper.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - ******************************************************************************/ -package at.gv.egiz.pdfas.lib.impl.signing.pdfbox2; - -import java.io.IOException; -import java.io.InputStream; -import java.security.SignatureException; -import java.util.Calendar; - -import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.pdfas.common.exceptions.PdfAsException; -import at.gv.egiz.pdfas.common.exceptions.PdfAsWrappedIOException; -import at.gv.egiz.pdfas.common.utils.PDFUtils; -import at.gv.egiz.pdfas.common.utils.StreamUtils; -import at.gv.egiz.pdfas.lib.api.sign.IPlainSigner; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; - -public class PdfboxSignerWrapper implements PDFASPDFBOXSignatureInterface { - - private static final Logger logger = LoggerFactory - .getLogger(PdfboxSignerWrapper.class); - - private IPlainSigner signer; - private PDSignature signature; - private int[] byteRange; - private Calendar date; - private SignParameter parameters; - private RequestedSignature requestedSignature; - - public PdfboxSignerWrapper(IPlainSigner signer, SignParameter parameters, RequestedSignature requestedSignature) { - this.signer = signer; - this.date = Calendar.getInstance(); - this.parameters = parameters; - this.requestedSignature = requestedSignature; - } - - public byte[] sign(InputStream inputStream) throws IOException { - byte[] data = StreamUtils.inputStreamToByteArray(inputStream); - byteRange = PDFUtils.extractSignatureByteRange(data); - int[] byteRange2 = signature.getByteRange(); - logger.debug("Byte Range 2: " + byteRange2); - try { - logger.debug("Signing with Pdfbox Wrapper"); - byte[] signature = signer.sign(data, byteRange, this.parameters, this.requestedSignature); - - return signature; - } catch (PdfAsException e) { - throw new PdfAsWrappedIOException(e); - } - } - - public int[] getByteRange() { - return byteRange; - } - - public String getPDFSubFilter() { - return this.signer.getPDFSubFilter(); - } - - public String getPDFFilter() { - return this.signer.getPDFFilter(); - } - - public void setPDSignature(PDSignature signature) { - this.signature = signature; - } - - public Calendar getSigningDate() { - return this.date; - } -} diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/SignatureDataExtractor.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/SignatureDataExtractor.java index 78e48e5e..41ff38aa 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/SignatureDataExtractor.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox2/SignatureDataExtractor.java @@ -23,6 +23,8 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl.signing.pdfbox2; +import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureExtractor; +import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureInterface; import iaik.x509.X509Certificate; import java.io.IOException; @@ -30,19 +32,23 @@ import java.io.InputStream; import java.security.SignatureException; import java.util.Calendar; +import lombok.Getter; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import at.gv.egiz.pdfas.common.utils.StreamUtils; +import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface; -public class SignatureDataExtractor implements PDFASPDFBOXExtractorInterface { +public class SignatureDataExtractor implements PDFASSignatureExtractor, PDFASSignatureInterface, SignatureInterface { - protected X509Certificate certificate; - protected byte[] signatureData; + @Getter + protected X509Certificate certificate; + @Getter + protected byte[] signatureData; protected String pdfSubFilter; protected String pdfFilter; - protected PDSignature signature; - protected int[] byteRange; + @Getter + protected int[] byteRange; protected Calendar date; public SignatureDataExtractor(X509Certificate certificate, @@ -52,41 +58,29 @@ public class SignatureDataExtractor implements PDFASPDFBOXExtractorInterface { this.pdfSubFilter = subfilter; this.date = date; } - - public X509Certificate getCertificate() { - return certificate; - } - public String getPDFSubFilter() { + public String getPDFSubFilter() { return this.pdfSubFilter; } - public String getPDFFilter() { + public String getPDFFilter() { return this.pdfFilter; } - public byte[] getSignatureData() { - return this.signatureData; - } - - public byte[] sign(InputStream content) throws IOException { - signatureData = StreamUtils.inputStreamToByteArray(content); - byteRange = this.signature.getByteRange(); - return new byte[] { 0 }; - } - - public void setPDSignature(PDSignature signature) { - this.signature = signature; - } + /** Called by PDFBox. + * We save the data to be signed and return an all-zeros signature (padded by pdfbox). + * We splice the actual signature in at a later point. + */ + public byte[] sign(InputStream content) throws IOException { + this.signatureData = StreamUtils.inputStreamToByteArray(content); + return new byte[] { 0 }; + } - public int[] getByteRange() { - return byteRange; - } + public void setPDSignature(PDSignature signature) { + this.byteRange = signature.getByteRange(); + } - public Calendar getSigningDate() { - return this.date; - } - - - + public Calendar getSigningDate() { + return this.date; + } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureBuilder.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureBuilder.java index a148b3ec..5501eff8 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureBuilder.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureBuilder.java @@ -29,6 +29,7 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.util.ArrayList; import java.util.HashMap; @@ -377,9 +378,9 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements public void createSignature(PDSignatureField pdSignatureField, PDPage page, String signatureName) throws IOException { PDSignature pdSignature = new PDSignature(); - pdSignatureField.setSignature(pdSignature); - pdSignatureField.getWidget().setPage(page); - page.getAnnotations().add(pdSignatureField.getWidget()); + pdSignatureField.setValue(pdSignature); + pdSignatureField.getWidgets().get(0).setPage(page); + page.getAnnotations().add(pdSignatureField.getWidgets().get(0)); pdSignature.setName(signatureName); pdSignature.setByteRange(new int[] { 0, 0, 0, 0 }); pdSignature.setContents(new byte[4096]); @@ -389,7 +390,6 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements public void createAcroFormDictionary(PDAcroForm acroForm, PDSignatureField signatureField) throws IOException { - @SuppressWarnings("unchecked") List<PDField> acroFormFields = acroForm.getFields(); COSDictionary acroFormDict = acroForm.getCOSObject(); acroFormDict.setDirect(true); @@ -481,7 +481,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements rect.setLowerLeftX((float) llDst.getX()); logger.debug("rectangle of signature has been created: {}", rect.toString()); - signatureField.getWidget().setRectangle(rect); + signatureField.getWidgets().get(0).setRectangle(rect); getStructure().setSignatureRectangle(rect); logger.debug("rectangle of signature has been created"); } @@ -553,13 +553,13 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements appearance.getCOSObject().setDirect(true); PDAppearanceStream appearanceStream = new PDAppearanceStream( - holderForml.getCOSStream()); + holderForml.getCOSObject()); AffineTransform transform = new AffineTransform(); transform.setToIdentity(); transform.rotate(Math.toRadians(degrees)); appearanceStream.setMatrix(transform); appearance.setNormalAppearance(appearanceStream); - signatureField.getWidget().setAppearance(appearance); + signatureField.getWidgets().get(0).setAppearance(appearance); getStructure().setAppearanceDictionary(appearance); logger.debug("PDF appereance Dictionary has been created"); @@ -586,7 +586,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements PDResources holderFormResources) { COSName name = holderFormResources.add(innerForm, "FRM");//TODO: pdfbox2 - is this right? getStructure().setInnerFormName(name); - logger.debug("Alerady inserted inner form inside holder form"); + logger.debug("Already inserted inner form inside holder form"); } public void createImageFormStream(PDDocument template) { @@ -637,7 +637,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements public void appendRawCommands(OutputStream os, String commands) throws IOException { - os.write(commands.getBytes("UTF-8")); + os.write(commands.getBytes(StandardCharsets.UTF_8)); os.close(); } @@ -678,8 +678,7 @@ public class PDFAsVisualSignatureBuilder extends PDVisibleSigBuilder implements COSName fontName = cosNameIterator.next(); PDFont pdFont = page.getResources().getFont(fontName); - if (pdFont instanceof PDType0Font) { - PDType0Font typedFont = (PDType0Font) pdFont; + if (pdFont instanceof PDType0Font typedFont) { if (typedFont.getDescendantFont() != null) { if (typedFont.getDescendantFont().getFontDescriptor() != null) { diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureDesigner.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureDesigner.java index 33450b56..6e198bba 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureDesigner.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFAsVisualSignatureDesigner.java @@ -284,7 +284,7 @@ public class PDFAsVisualSignatureDesigner { /** * - * @param imgageStream + * @param imageStream * - stream of your visible signature image * @return Visible Signature Configuration Object * @throws IOException diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxFont.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxFont.java index 5607d582..58779f09 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxFont.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxFont.java @@ -161,7 +161,7 @@ public class PDFBoxFont { String fontName = fonttype.replaceFirst("TTF:", ""); String fontPath = this.settings.getWorkingDirectory() + File.separator + "fonts" + File.separator + fontName; - logger.debug("Font from: \"" + fontPath + "\"."); + logger.debug("Font from: \"{}\".", fontPath); PDFAsFontCache fontCache = pdfObject.getSigBlockFontCache(); if(fontCache.contains(fontPath)){ logger.debug("Using cached font."); @@ -189,8 +189,11 @@ public class PDFBoxFont { boolean requirePDFA3 = signatureProfileSettings.isPDFA3(); */ - PDType0Font font = PDType0Font.load(pdfObject.getDocument(), new FileInputStream(fontPath)); - fontCache.addFont(fontPath,font); + PDType0Font font; + try (FileInputStream fontStream = new FileInputStream(fontPath)) { + font = PDType0Font.load(pdfObject.getDocument(), fontStream); + } + fontCache.addFont(fontPath, font); return font; @@ -242,7 +245,7 @@ public class PDFBoxFont { PDFBOXObject pdfObject) throws IOException { this.settings = settings; this.fontDesc = fontDesc; - logger.debug("Creating Font: " + fontDesc); + logger.debug("Creating Font: {}", fontDesc); this.setFont(fontDesc, pdfObject); } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java index bc634dc5..4d8050b5 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PDFBoxTable.java @@ -65,7 +65,6 @@ public class PDFBoxTable { float tableHeight; Color bgColor; - boolean[] addPadding; float[] rowHeights; float[] colWidths; @@ -215,7 +214,6 @@ public class PDFBoxTable { PdfAsException { int rows = this.table.getRows().size(); rowHeights = new float[rows]; - addPadding = new boolean[rows]; for (int i = 0; i < rows; i++) { rowHeights[i] = 0; @@ -521,16 +519,12 @@ public class PDFBoxTable { try { byte[] linebytes = StringUtils.applyWinAnsiEncoding(lines[i]); for (int j = 0; j < linebytes.length; j++) { - float he = c.getHeight(linebytes[j]) / 1000 + float he = c.getBoundingBox().getHeight() / 1000 * fontSize; if (he > maxLineHeight) { maxLineHeight = he; } } - } catch (UnsupportedEncodingException e) { - logger.warn("failed to determine String height", e); - maxLineHeight = c.getFontDescriptor().getCapHeight() / 1000 - * fontSize; } catch (IOException e) { logger.warn("failed to determine String height", e); maxLineHeight = c.getFontDescriptor().getCapHeight() / 1000 diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PdfBoxStamper.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PdfBoxStamper.java index f89d53c5..acb75560 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PdfBoxStamper.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/PdfBoxStamper.java @@ -35,7 +35,7 @@ import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import at.knowcenter.wag.egov.egiz.pdf.PositioningInstruction; import at.knowcenter.wag.egov.egiz.table.Table; -public class PdfBoxStamper implements IPDFStamper { +public class PdfBoxStamper implements IPDFStamper<PDFBOXObject> { // private static final Logger logger = LoggerFactory.getLogger(PdfBoxStamper.class); @@ -45,23 +45,12 @@ public class PdfBoxStamper implements IPDFStamper { // this.pdfBuilder = new PDVisibleSigBuilder(); } - public IPDFVisualObject createVisualPDFObject(PDFObject pdf, Table table) throws IOException { + public IPDFVisualObject createVisualPDFObject(PDFBOXObject pdfboxObject, Table table) throws IOException { try { - PDFBOXObject pdfboxObject = (PDFBOXObject)pdf; - return new PdfBoxVisualObject(table, pdf.getStatus().getSettings(), pdfboxObject); + return new PdfBoxVisualObject(table, pdfboxObject.getStatus().getSettings(), pdfboxObject); } catch (PdfAsException e) { throw new PdfAsWrappedIOException(e); } } - public byte[] writeVisualObject(IPDFVisualObject visualObject, - PositioningInstruction positioningInstruction, byte[] pdfData, - String placeholderName) throws PdfAsException { - return null; - } - - public void setSettings(ISettings settings) { - // not needed currently - } - } diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/StamperFactory.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/StamperFactory.java index 90561740..88a21c36 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/StamperFactory.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/StamperFactory.java @@ -2,6 +2,7 @@ package at.gv.egiz.pdfas.lib.impl.stamping.pdfbox2; import at.gv.egiz.pdfas.common.exceptions.PdfAsException; import at.gv.egiz.pdfas.common.settings.ISettings; +import at.gv.egiz.pdfas.lib.impl.pdfbox2.PDFBOXObject; import at.gv.egiz.pdfas.lib.impl.stamping.IPDFStamper; public class StamperFactory { @@ -9,14 +10,14 @@ public class StamperFactory { //public static final String DEFAULT_STAMPER_CLASS = "at.gv.egiz.pdfas.stmp.itext.ITextStamper"; public static final String DEFAULT_STAMPER_CLASS = "at.gv.egiz.pdfas.lib.impl.stamping.pdfbox2.PdfBoxStamper"; - public static IPDFStamper createDefaultStamper(ISettings settings) throws PdfAsException { + public static IPDFStamper<PDFBOXObject> createDefaultStamper(ISettings settings) throws PdfAsException { try { Class<?> cls = Class.forName(DEFAULT_STAMPER_CLASS); - Object st = cls.newInstance(); + Object st = cls.getDeclaredConstructor().newInstance(); if (!(st instanceof IPDFStamper)) throw new ClassCastException(); - IPDFStamper stamper = (IPDFStamper) st; - stamper.setSettings(settings); + @SuppressWarnings("unchecked") + IPDFStamper<PDFBOXObject> stamper = (IPDFStamper<PDFBOXObject>) st; return stamper; } catch (Throwable e) { throw new PdfAsException("error.pdf.stamp.10", e); diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java index d49a6518..8df2ca59 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox2/TableDrawUtils.java @@ -26,6 +26,7 @@ package at.gv.egiz.pdfas.lib.impl.stamping.pdfbox2; import java.awt.Color; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.Map; @@ -486,22 +487,18 @@ public class TableDrawUtils { float[] colsSizes = new float[max_cols]; if (origcolsSizes == null) { // set the column ratio for all columns to 1 - for (int cols_idx = 0; cols_idx < colsSizes.length; cols_idx++) { - colsSizes[cols_idx] = 1; - } + Arrays.fill(colsSizes, 1); } else { // set the column ratio for all columns to 1 - for (int cols_idx = 0; cols_idx < colsSizes.length; cols_idx++) { - colsSizes[cols_idx] = origcolsSizes[cols_idx]; - } + System.arraycopy(origcolsSizes, 0, colsSizes, 0, colsSizes.length); } // adapt float total = 0; - for (int cols_idx = 0; cols_idx < colsSizes.length; cols_idx++) { - total += colsSizes[cols_idx]; - } + for (float colsSize : colsSizes) { + total += colsSize; + } for (int cols_idx = 0; cols_idx < colsSizes.length; cols_idx++) { colsSizes[cols_idx] = (colsSizes[cols_idx] / total) @@ -510,9 +507,9 @@ public class TableDrawUtils { float sum = 0; - for (int cols_idx = 0; cols_idx < colsSizes.length; cols_idx++) { - sum += colsSizes[cols_idx]; - } + for (float colsSize : colsSizes) { + sum += colsSize; + } logger.debug("Table Col Sizes SUM {} Table Width {}", sum, abstractTable.getWidth()); @@ -521,6 +518,14 @@ public class TableDrawUtils { return colsSizes; } + private static void drawLine(PDPageContentStream stream, float startX, float startY, float endX, float endY) + throws IOException + { + stream.moveTo(startX, startY); + stream.lineTo(endX, endY); + stream.stroke(); + } + public static void drawBorder(PDPage page, PDPageContentStream contentStream, float x, float y, float width, float height, PDFBoxTable abstractTable, PDDocument doc, @@ -545,7 +550,7 @@ public class TableDrawUtils { // draw first line logger.debug("ROW LINE: {} {} {} {}", x_from, y_from, x_to, y_from); - contentStream.drawLine(x, y_from, x_to, y_from); + drawLine(contentStream, x, y_from, x_to, y_from); // Draw all row borders for (int i = 0; i < rows; i++) { @@ -554,7 +559,7 @@ public class TableDrawUtils { // Draw row border! logger.debug("ROW LINE: {} {} {} {}", x_from, y_from, x_to, y_from); - contentStream.drawLine(x, y_from, x_to, y_from); + drawLine(contentStream, x, y_from, x_to, y_from); } @@ -573,7 +578,7 @@ public class TableDrawUtils { logger.debug("COL LINE: {} {} {} {}", x_from, y_from, x_from, y_to); - contentStream.drawLine(x_from, y_from, x_from, y_to); + drawLine(contentStream, x_from, y_from, x_from, y_to); for (int j = 0; j < row.size(); j++) { Entry cell = (Entry) row.get(j); @@ -585,7 +590,7 @@ public class TableDrawUtils { } logger.debug("COL LINE: {} {} {} {}", x_from, y_from, x_from, y_to); - contentStream.drawLine(x_from, y_from, x_from, y_to); + drawLine(contentStream, x_from, y_from, x_from, y_to); } if (i + 1 < rows) { @@ -608,8 +613,9 @@ public class TableDrawUtils { try { if (abstractTable.getBGColor() != null) { contentStream.setNonStrokingColor(abstractTable.getBGColor()); - contentStream.fillRect(x, y, abstractTable.getWidth(), - abstractTable.getHeight()); + contentStream + .addRect(x, y, abstractTable.getWidth(), abstractTable.getHeight()); + contentStream.fill(); contentStream.setNonStrokingColor(Color.BLACK); } } catch (Throwable e) { @@ -623,13 +629,13 @@ public class TableDrawUtils { if ("true".equals(settings.getValue(TABLE_DEBUG))) { try { contentStream.setStrokingColor(Color.RED); - contentStream.drawLine(x, y, x + width, y); + drawLine(contentStream, x, y, x + width, y); contentStream.setStrokingColor(Color.BLUE); - contentStream.drawLine(x, y, x, y - height); + drawLine(contentStream, x, y, x, y - height); contentStream.setStrokingColor(Color.GREEN); - contentStream.drawLine(x + width, y, x + width, y - height); + drawLine(contentStream, x + width, y, x + width, y - height); contentStream.setStrokingColor(Color.ORANGE); - contentStream.drawLine(x, y - height, x + width, y - height); + drawLine(contentStream, x, y - height, x + width, y - height); contentStream.setStrokingColor(Color.BLACK); } catch (Throwable e) { @@ -643,15 +649,15 @@ public class TableDrawUtils { if ("true".equals(settings.getValue(TABLE_DEBUG))) { try { contentStream.setStrokingColor(Color.RED); - contentStream.drawLine(x, y, x + width, y); + drawLine(contentStream, x, y, x + width, y); contentStream.setStrokingColor(Color.BLUE); - contentStream.drawLine(x, y, x, y - height); + drawLine(contentStream, x, y, x, y - height); contentStream.setStrokingColor(Color.GREEN); - contentStream.drawLine(x + width, y, x + width, y - height); + drawLine(contentStream, x + width, y, x + width, y - height); contentStream.setStrokingColor(Color.ORANGE); - contentStream.drawLine(x, y - height, x + width, y - height); + drawLine(contentStream, x, y - height, x + width, y - height); contentStream.setStrokingColor(Color.MAGENTA); - contentStream.drawLine(x, y + (descent * (-1)) - height, x + width, y + (descent * (-1)) - height); + drawLine(contentStream, x, y + (descent * (-1)) - height, x + width, y + (descent * (-1)) - height); contentStream.setStrokingColor(Color.BLACK); } catch (Throwable e) { @@ -666,12 +672,12 @@ public class TableDrawUtils { if ("true".equals(settings.getValue(TABLE_DEBUG))) { try { contentStream.setStrokingColor(Color.RED); - contentStream.drawLine(x, y, x + padding, y - padding); - contentStream.drawLine(x + width, y, x + width - padding, y + drawLine(contentStream, x, y, x + padding, y - padding); + drawLine(contentStream, x + width, y, x + width - padding, y - padding); - contentStream.drawLine(x + width, y - height, x + width + drawLine(contentStream, x + width, y - height, x + width - padding, y - height + padding); - contentStream.drawLine(x, y - height, x + padding, y - height + drawLine(contentStream, x, y - height, x + padding, y - height + padding); contentStream.setStrokingColor(Color.BLACK); } catch (Throwable e) { diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox2/PDFBOXVerifier.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox2/PDFBOXVerifier.java index 1fab2793..0c943027 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox2/PDFBOXVerifier.java +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/pdfbox2/PDFBOXVerifier.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; +import at.gv.egiz.pdfas.lib.impl.verify.*; import org.apache.commons.io.IOUtils; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSBase; @@ -21,10 +22,6 @@ import at.gv.egiz.pdfas.common.settings.ISettings; import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; import at.gv.egiz.pdfas.lib.impl.ErrorExtractor; -import at.gv.egiz.pdfas.lib.impl.verify.IVerifier; -import at.gv.egiz.pdfas.lib.impl.verify.IVerifyFilter; -import at.gv.egiz.pdfas.lib.impl.verify.VerifierDispatcher; -import at.gv.egiz.pdfas.lib.impl.verify.VerifyBackend; public class PDFBOXVerifier implements VerifyBackend { @@ -148,27 +145,18 @@ public class PDFBOXVerifier implements VerifyBackend { logger.debug("Filter: " + dict.getNameAsString("Filter")); logger.debug("Modified: " + dict.getNameAsString("M")); COSArray byteRange = (COSArray) dict.getDictionaryObject("ByteRange"); - + StringBuilder sb = new StringBuilder(); - int[] bytes = new int[byteRange.size()]; + final int[] bytes = new int[byteRange.size()]; for (int j = 0; j < byteRange.size(); j++) { bytes[j] = byteRange.getInt(j); sb.append(" " + bytes[j]); } - + logger.debug("ByteRange" + sb.toString()); COSString content = (COSString) dict.getDictionaryObject("Contents"); - ByteArrayOutputStream contentData = new ByteArrayOutputStream(); - for (int j = 0; j < bytes.length; j = j + 2) { - int offset = bytes[j]; - int length = bytes[j + 1]; - - contentData.write(inputData, offset, length); - } - contentData.close(); - IVerifyFilter verifyFilter = verifier.getVerifier(dict.getNameAsString("Filter"), dict.getNameAsString("SubFilter")); @@ -176,8 +164,8 @@ public class PDFBOXVerifier implements VerifyBackend { synchronized (lvlVerifier) { lvlVerifier.setConfiguration(parameter.getConfiguration()); if (verifyFilter != null) { - List<VerifyResult> results = verifyFilter.verify(contentData.toByteArray(), - content.getBytes(), parameter.getVerificationTime(), bytes, lvlVerifier); + List<VerifyResult> results = verifyFilter.verify(new SignatureInputData(inputData, bytes), + content.getBytes(), parameter.getVerificationTime(), lvlVerifier); if (results != null && !results.isEmpty()) { result.addAll(results); } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFPage.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFPage.java index a3e68c95..c49d99a5 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFPage.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/PDFPage.java @@ -55,6 +55,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.math.NumberUtils; import org.apache.pdfbox.contentstream.operator.Operator; import org.apache.pdfbox.contentstream.operator.OperatorProcessor; @@ -127,8 +129,21 @@ public class PDFPage extends PDFTextStripper{ /** * The path currently being constructed. - */ - private GeneralPath currentPath = new GeneralPath(); + * -- SETTER -- + * Sets the current path. + * + * + * -- GETTER -- + * Returns the path currently being constructed. + * + @param currentPath + * The new current path. + * @return The path currently being constructed. + + */ + @Getter + @Setter + private GeneralPath currentPath = new GeneralPath(); private boolean legacy40; @@ -155,8 +170,7 @@ public class PDFPage extends PDFTextStripper{ this.effectivePageHeight = effectivePageHeight; OperatorProcessor newInvoke = new MyInvoke(this); - newInvoke.setContext(this); - this.registerOperatorProcessor("Do", newInvoke); + this.addOperator(newInvoke); if (!legacy32) { registerCustomPathOperators(); @@ -172,32 +186,26 @@ public class PDFPage extends PDFTextStripper{ private void registerCustomPathOperators() { // *** path construction - this.registerOperatorProcessor("m", new MoveTo(this)); - this.registerOperatorProcessor("l", new LineTo(this)); - this.registerOperatorProcessor("c", new CurveTo(this)); - this.registerOperatorProcessor("y", - new CurveToReplicateFinalPoint(this)); - this.registerOperatorProcessor("v", new CurveToReplicateInitialPoint( - this)); - this.registerOperatorProcessor("h", new ClosePath(this)); + this.addOperator(new MoveTo(this)); + this.addOperator(new LineTo(this)); + this.addOperator(new CurveTo(this)); + this.addOperator(new CurveToReplicateFinalPoint(this)); + this.addOperator(new CurveToReplicateInitialPoint(this)); + this.addOperator(new ClosePath(this)); // *** path painting // "S": stroke path - this.registerOperatorProcessor("S", new StrokePath(this)); - this.registerOperatorProcessor("s", new CloseAndStrokePath(this)); - this.registerOperatorProcessor("f", - new FillPathNonZeroWindingNumberRule(this)); - this.registerOperatorProcessor("F", - new FillPathNonZeroWindingNumberRule(this)); - this.registerOperatorProcessor("f*", new FillPathEvenOddRule(this)); - this.registerOperatorProcessor("b", new CloseFillNonZeroAndStrokePath( - this)); - this.registerOperatorProcessor("B", new FillNonZeroAndStrokePath(this)); - this.registerOperatorProcessor("b*", new CloseFillEvenOddAndStrokePath( - this)); - this.registerOperatorProcessor("B*", new FillEvenOddAndStrokePath(this)); - this.registerOperatorProcessor("n", new EndPath(this)); + this.addOperator(new StrokePath(this)); + this.addOperator(new CloseAndStrokePath(this)); + this.addOperator(new FillPathNonZeroWindingNumberRule(this, true)); + this.addOperator(new FillPathNonZeroWindingNumberRule(this, false)); + this.addOperator(new FillPathEvenOddRule(this)); + this.addOperator(new CloseFillNonZeroAndStrokePath(this)); + this.addOperator(new FillNonZeroAndStrokePath(this)); + this.addOperator(new CloseFillEvenOddAndStrokePath(this)); + this.addOperator(new FillEvenOddAndStrokePath(this)); + this.addOperator(new EndPath(this)); // Note: The graphic context // (org.pdfbox.pdmodel.graphics.PDGraphicsState) of the underlying @@ -209,26 +217,7 @@ public class PDFPage extends PDFTextStripper{ } - /** - * Returns the path currently being constructed. - * - * @return The path currently being constructed. - */ - public GeneralPath getCurrentPath() { - return currentPath; - } - - /** - * Sets the current path. - * - * @param currentPath - * The new current path. - */ - public void setCurrentPath(GeneralPath currentPath) { - this.currentPath = currentPath; - } - - /** + /** * Registers a rectangle that bounds the path currently being drawn. * * @param bounds @@ -448,8 +437,8 @@ public class PDFPage extends PDFTextStripper{ PDXObject xobject = context.getResources().getXObject(name); - PDStream stream = xobject.getPDStream(); - COSStream cos_stream = stream.getStream(); + PDStream stream = xobject.getStream(); + COSStream cos_stream = stream.getCOSObject(); COSName subtype = (COSName) cos_stream .getDictionaryObject(COSName.SUBTYPE); @@ -550,8 +539,7 @@ public class PDFPage extends PDFTextStripper{ @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "Do"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/ClosePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/ClosePath.java index 50b3b4d0..098ce8f6 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/ClosePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/ClosePath.java @@ -91,8 +91,7 @@ public class ClosePath extends PathConstructionOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "h"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveTo.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveTo.java index da1288d3..e6b76400 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveTo.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveTo.java @@ -87,9 +87,9 @@ public class CurveTo extends PathConstructionOperatorProcessor { COSNumber x3 = (COSNumber) operands.get(4); COSNumber y3 = (COSNumber) operands.get(5); - Point2D p1 = transform(x1.doubleValue(), y1.doubleValue()); - Point2D p2 = transform(x2.doubleValue(), y2.doubleValue()); - Point2D p3 = transform(x3.doubleValue(), y3.doubleValue()); + Point2D p1 = transform(x1.floatValue(), y1.floatValue()); + Point2D p2 = transform(x2.floatValue(), y2.floatValue()); + Point2D p3 = transform(x3.floatValue(), y3.floatValue()); pdfPage.getCurrentPath().curveTo( (float) p1.getX(), (float) p1.getY(), @@ -108,8 +108,7 @@ public class CurveTo extends PathConstructionOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "c"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateFinalPoint.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateFinalPoint.java index 458e8b3e..86c95c17 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateFinalPoint.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateFinalPoint.java @@ -85,8 +85,8 @@ public class CurveToReplicateFinalPoint extends PathConstructionOperatorProcesso COSNumber x3 = (COSNumber) operands.get(2); COSNumber y3 = (COSNumber) operands.get(3); - Point2D p1 = transform(x1.doubleValue(), y1.doubleValue()); - Point2D p3 = transform(x3.doubleValue(), y3.doubleValue()); + Point2D p1 = transform(x1.floatValue(), y1.floatValue()); + Point2D p3 = transform(x3.floatValue(), y3.floatValue()); pdfPage.getCurrentPath().curveTo( (float) p1.getX(), (float) p1.getY(), @@ -105,8 +105,7 @@ public class CurveToReplicateFinalPoint extends PathConstructionOperatorProcesso @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "y"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateInitialPoint.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateInitialPoint.java index d3a4e5e3..91c90589 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateInitialPoint.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/CurveToReplicateInitialPoint.java @@ -86,8 +86,8 @@ public class CurveToReplicateInitialPoint extends PathConstructionOperatorProces COSNumber y3 = (COSNumber) operands.get(3); Point2D currentPoint = pdfPage.getCurrentPath().getCurrentPoint(); - Point2D p2 = transform(x2.doubleValue(), y2.doubleValue()); - Point2D p3 = transform(x3.doubleValue(), y3.doubleValue()); + Point2D p2 = transform(x2.floatValue(), y2.floatValue()); + Point2D p3 = transform(x3.floatValue(), y3.floatValue()); pdfPage.getCurrentPath().curveTo( (float)currentPoint.getX(), (float)currentPoint.getY(), @@ -107,8 +107,7 @@ public class CurveToReplicateInitialPoint extends PathConstructionOperatorProces @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "v"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/LineTo.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/LineTo.java index a3bee751..94fbbbb0 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/LineTo.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/LineTo.java @@ -80,7 +80,7 @@ public class LineTo extends PathConstructionOperatorProcessor { COSNumber x = (COSNumber) operands.get(0); COSNumber y = (COSNumber) operands.get(1); - Point2D p = transform(x.doubleValue(), y.doubleValue()); + Point2D p = transform(x.floatValue(), y.floatValue()); pdfPage.getCurrentPath().lineTo((float) p.getX(), (float) p.getY()); @@ -94,8 +94,7 @@ public class LineTo extends PathConstructionOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "l"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/MoveTo.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/MoveTo.java index 624405f8..3fe123ea 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/MoveTo.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/construction/MoveTo.java @@ -67,7 +67,7 @@ import at.knowcenter.wag.egov.egiz.pdfbox2.pdf.operator.path.PathConstructionOpe * @see "PDF 1.7 specification, Section 8.5.2 'Path Construction Operators'" * @author PdfBox, modified by Datentechnik Innovation GmbH */ -public class MoveTo extends PathConstructionOperatorProcessor{ +public class MoveTo extends PathConstructionOperatorProcessor{ public MoveTo(PDFPage context) { super(context); @@ -82,7 +82,7 @@ public class MoveTo extends PathConstructionOperatorProcessor{ COSNumber x = (COSNumber) operands.get(0); COSNumber y = (COSNumber) operands.get(1); - Point2D p = transform(x.doubleValue(), y.doubleValue()); + Point2D p = transform(x.floatValue(), y.floatValue()); pdfPage.getCurrentPath().moveTo((float) p.getX(), (float) p.getY()); @@ -97,8 +97,7 @@ public class MoveTo extends PathConstructionOperatorProcessor{ @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "m"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseAndStrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseAndStrokePath.java index 488819ac..37182ddc 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseAndStrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseAndStrokePath.java @@ -82,8 +82,7 @@ public class CloseAndStrokePath extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "s"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java index 41078e40..597084e8 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillEvenOddAndStrokePath.java @@ -83,8 +83,7 @@ public class CloseFillEvenOddAndStrokePath extends PathPaintingOperatorProcessor @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "b*"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java index ef297ca9..8ab72438 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/CloseFillNonZeroAndStrokePath.java @@ -83,8 +83,7 @@ public class CloseFillNonZeroAndStrokePath extends PathPaintingOperatorProcessor @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "b"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/EndPath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/EndPath.java index 0001d7e5..a43df0a2 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/EndPath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/EndPath.java @@ -91,8 +91,7 @@ public class EndPath extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "n"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillEvenOddAndStrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillEvenOddAndStrokePath.java index 12a4b037..77e65666 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillEvenOddAndStrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillEvenOddAndStrokePath.java @@ -95,8 +95,7 @@ public class FillEvenOddAndStrokePath extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "B*"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillNonZeroAndStrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillNonZeroAndStrokePath.java index a6fca720..9a1f0b69 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillNonZeroAndStrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillNonZeroAndStrokePath.java @@ -95,8 +95,7 @@ public class FillNonZeroAndStrokePath extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "B"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathEvenOddRule.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathEvenOddRule.java index 10eeae03..092ba751 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathEvenOddRule.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathEvenOddRule.java @@ -94,8 +94,7 @@ public class FillPathEvenOddRule extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "f*"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java index ca8922fc..3b8d13f9 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/FillPathNonZeroWindingNumberRule.java @@ -68,9 +68,11 @@ import at.knowcenter.wag.egov.egiz.pdfbox2.pdf.operator.path.PathPaintingOperato public class FillPathNonZeroWindingNumberRule extends PathPaintingOperatorProcessor { private Log log = LogFactory.getLog(getClass()); + private final boolean lowercase; - public FillPathNonZeroWindingNumberRule(PDFPage context) { + public FillPathNonZeroWindingNumberRule(PDFPage context, boolean lowercase) { super(context); + this.lowercase = lowercase; } @Override @@ -95,8 +97,7 @@ public class FillPathNonZeroWindingNumberRule extends PathPaintingOperatorProces @Override public String getName() { - // TODO Auto-generated method stub - return null; + return lowercase ? "f" : "F"; } } diff --git a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/StrokePath.java b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/StrokePath.java index 3dc0965e..ef9fc24b 100644 --- a/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/StrokePath.java +++ b/pdf-as-pdfbox-2/src/main/java/at/knowcenter/wag/egov/egiz/pdfbox2/pdf/operator/path/painting/StrokePath.java @@ -93,8 +93,7 @@ public class StrokePath extends PathPaintingOperatorProcessor { @Override public String getName() { - // TODO Auto-generated method stub - return null; + return "S"; } } |
