diff options
author | Christian Maierhofer <cmaierhofer@iaik.tugraz.at> | 2016-06-08 08:12:21 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-08-17 16:45:49 +0200 |
commit | c4e41301d0746ce57044a3aa41375cff3a9f2b5e (patch) | |
tree | bdf13d0a0d7fae97215a84286e31ff894bacc979 /pdf-as-pdfbox/src | |
parent | a7945fff6ca14d35ac75039712736dddc6d48e90 (diff) | |
download | pdf-as-4-c4e41301d0746ce57044a3aa41375cff3a9f2b5e.tar.gz pdf-as-4-c4e41301d0746ce57044a3aa41375cff3a9f2b5e.tar.bz2 pdf-as-4-c4e41301d0746ce57044a3aa41375cff3a9f2b5e.zip |
initial pdfbox-2 commit
Diffstat (limited to 'pdf-as-pdfbox/src')
2 files changed, 28 insertions, 8 deletions
diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java index 16dfadf4..751c1291 100644 --- a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/signing/pdfbox/PADESPDFBOXSigner.java @@ -23,6 +23,8 @@ ******************************************************************************/ package at.gv.egiz.pdfas.lib.impl.signing.pdfbox; +import iaik.x509.X509Certificate; + import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; @@ -35,7 +37,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import java.util.Map; import org.apache.commons.io.IOUtils; import org.apache.pdfbox.cos.COSArray; @@ -44,10 +45,7 @@ import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSDocument; import org.apache.pdfbox.cos.COSInteger; import org.apache.pdfbox.cos.COSName; -import org.apache.pdfbox.cos.COSNumber; -import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.cos.COSString; -import org.apache.pdfbox.cos.ICOSVisitor; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.exceptions.SignatureException; import org.apache.pdfbox.pdmodel.PDDocument; @@ -55,13 +53,11 @@ import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDPageNode; import org.apache.pdfbox.pdmodel.PDResources; -import org.apache.pdfbox.pdmodel.common.COSObjectable; import org.apache.pdfbox.pdmodel.common.PDNumberTreeNode; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureElement; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg; -import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.PDSignature; import org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureOptions; import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm; @@ -93,18 +89,17 @@ import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureExtractor; import at.gv.egiz.pdfas.lib.impl.signing.PDFASSignatureInterface; import at.gv.egiz.pdfas.lib.impl.stamping.IPDFStamper; import at.gv.egiz.pdfas.lib.impl.stamping.IPDFVisualObject; -import at.gv.egiz.pdfas.lib.impl.stamping.StamperFactory; import at.gv.egiz.pdfas.lib.impl.stamping.TableFactory; import at.gv.egiz.pdfas.lib.impl.stamping.ValueResolver; import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.PDFAsVisualSignatureProperties; import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.PdfBoxVisualObject; +import at.gv.egiz.pdfas.lib.impl.stamping.pdfbox.StamperFactory; import at.gv.egiz.pdfas.lib.impl.status.OperationStatus; import at.gv.egiz.pdfas.lib.impl.status.PDFObject; import at.gv.egiz.pdfas.lib.impl.status.RequestedSignature; import at.knowcenter.wag.egov.egiz.pdf.PositioningInstruction; import at.knowcenter.wag.egov.egiz.pdf.TablePos; import at.knowcenter.wag.egov.egiz.table.Table; -import iaik.x509.X509Certificate; public class PADESPDFBOXSigner implements IPdfSigner, IConfigurationConstants { diff --git a/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/StamperFactory.java b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/StamperFactory.java new file mode 100644 index 00000000..d9377d7f --- /dev/null +++ b/pdf-as-pdfbox/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/pdfbox/StamperFactory.java @@ -0,0 +1,25 @@ +package at.gv.egiz.pdfas.lib.impl.stamping.pdfbox; + +import at.gv.egiz.pdfas.common.exceptions.PdfAsException; +import at.gv.egiz.pdfas.common.settings.ISettings; +import at.gv.egiz.pdfas.lib.impl.stamping.IPDFStamper; + +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.pdfbox.PdfBoxStamper"; + + public static IPDFStamper createDefaultStamper(ISettings settings) throws PdfAsException { + try { + Class<?> cls = Class.forName(DEFAULT_STAMPER_CLASS); + Object st = cls.newInstance(); + if (!(st instanceof IPDFStamper)) + throw new ClassCastException(); + IPDFStamper stamper = (IPDFStamper) st; + stamper.setSettings(settings); + return stamper; + } catch (Throwable e) { + throw new PdfAsException("error.pdf.stamp.10", e); + } + } +}
\ No newline at end of file |