OK, I'm attaching a signed PDF and the code I'm using to obtain the revision.
But the first revision obtained with this code contains the signature field.
How can I obtain a revision without the signature field?

the code:
                byte bb[] = new byte[8192];
                PdfReader reader;
                reader = new PdfReader(entrada);
                AcroFields af = null;
                ArrayList names = null;
                af = reader.getAcroFields();
                names = af.getSignatureNames();
                for (int k = 0; k < names.size(); ++k) {
                        String name = (String)names.get(k);
                        if (af.getRevision(name)==numRevision){
                                InputStream ip = af.extractRevision(name);
                                int n = 0;
                                while ((n = ip.read(bb)) > 0)
                                        out.write(bb,0,n);
                                ip.close();
                                out.close();
                                return;
                        }
                }
        }


Thanks for all.

http://www.nabble.com/file/p23649098/firmado2vecesOk.pdf firmado2vecesOk.pdf 



mkl wrote:
> 
> Oscar,
> 
> 
> Oscar P wrote:
>> 
>> Hi again,
>> 
>> thaks for all answer.
>> 
>> how i can sign in append mode to obtain original PDF? 
>> 
>> I sign with this code:
>> 
>>              PdfReader reader;
>>              PrivateKey privateKey = null;
>>              Certificate[] chain = null;
>>              privateKey = alm.getClavePrivada(alias, pwdPrivateKey);
>>              chain = alm.getKeyStore().getCertificateChain(alias);
>>              reader = new PdfReader(entrada);
>>              PdfStamper stamper;
>>              stamper = PdfStamper.createSignature(reader, salida, 
>> '\0',null,true);
>> //this true is to append mode?
>> 
> 
> Yes, it is.
> 
> 
> Oscar P wrote:
>> 
>>              PdfSignatureAppearance appearance = 
>> stamper.getSignatureAppearance();
>>              appearance.setCrypto(privateKey,chain,
>> null,PdfSignatureAppearance.WINCER_SIGNED);
>>              Calendar signedDate = new GregorianCalendar();
>>              appearance.setSignDate(signedDate);
>>              try {
>>                      stamper.close();
>>              } catch (Exception e) {
>>                      throw new CifraFirmaException("Error al realizar la 
>> firma, no se pudo
>> leer correctamente el PDF",e);
>>              }
>> 
>> When i sign i get a unique revision, and this revision include the
>> signature field.
>> 
>> 
>> thaks for all.
>> 
> 
> Yes, the revision you create includes the signature field. The document
> should also contain the former revision. I actually use a slightly
> different approach here, but yours should also have that older revision
> inside. If you're not sure, just post an example document and we'll check.
> 
> Regards,   Michael.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Signature-PDF.-How-obtain-Original-PDF-tp23620527p23649098.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to