pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PDFBOX-2470) Exception in PDDocument.addSignature(PDSignature sigObject, SignatureInterface signatureInterface, SignatureOptions options))
Date Fri, 07 Nov 2014 22:42:35 GMT

    [ https://issues.apache.org/jira/browse/PDFBOX-2470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14202861#comment-14202861
] 

ASF subversion and git services commented on PDFBOX-2470:
---------------------------------------------------------

Commit 1637476 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1637476 ]

PDFBOX-2470: avoid ClassCastException or NullPointerException in addSignature, as suggested
by Huynh and John Hewson

> Exception in PDDocument.addSignature(PDSignature sigObject, SignatureInterface signatureInterface,
SignatureOptions options))
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-2470
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2470
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 1.8.7
>            Reporter: Huynh
>              Labels: patch
>             Fix For: 1.8.8, 2.0.0
>
>         Attachments: fichedescriptiveformulaire_8954_signed.pdf
>
>
> Hi
> I have made the following modifications to avoid ClassCastException or NullPointerException
in addSignature(PDSignature sigObject, SignatureInterface signatureInterface, SignatureOptions
options) :
> {code}
>                         // read and set Appearance Dictionary
>                         // MOD_CS
>                         // PDAppearanceDictionary ap = 
>                         //        new PDAppearanceDictionary((COSDictionary)cosBaseDict.getItem(COSName.AP));
>                         // ap.getDictionary().setDirect(true);
>                         // signatureField.getWidget().setAppearance(ap);
>                         COSBase item = cosBaseDict.getItem(COSName.AP);
>                         if (item instanceof COSObject) {
>                         	item = ((COSObject) item).getObject();
>                         }
>                     	if (item instanceof COSDictionary) {
>                     		PDAppearanceDictionary ap = new PDAppearanceDictionary((COSDictionary)
item);
>                     		ap.getDictionary().setDirect(true);
>                     		signatureField.getWidget().setAppearance(ap);
>                     	}
>                     	
>                         // read and set AcroForm DefaultRessource 
>                         COSBase dr = cosBaseDict.getItem(COSName.DR);
>                         // MOD_CS
>                         if (dr != null) {
> 	                        dr.setDirect(true);
> 	                        dr.setNeedToBeUpdate(true);
> 	                        acroFormDict.setItem(COSName.DR, dr);
>                         }
> {code}
> Regards



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message