Ah ok found it:

PdfDictionary acroForm =
(PdfDictionary)PdfReader.getPdfObject(this.reader.getCatalog().get(PdfName.ACROFORM),
this.reader.getCatalog());

:)

> > Don't use PRAcroForm, ever. Get the acroform through the catalog
Maybe mark this method as deprecated - helps to stop the confusion...


>
> After your suggestion i would have fetched the acroform through the
> catalog like this:
> PdfObject form = this.reader.getCatalog().get(PdfName.ACROFORM);
>
> But if i look into the code of the method 'getAcroForm' i read:
> PdfObject form = catalog.get(PdfName.ACROFORM);
>
> So where's the difference?
> Afterwards i would have constructed the AcroForm Object (propably)
> like
> you did
> to be able to change the 'SigFlags' flag. Or is there another way to
> do
> that?
>
> > and remember that the acroform may not exist.
> Do you mean it does not exist for PDF's without form fields?
> Or is there the possibility if you have a formfields-PDF and there is
> no
> Acroform?
>
> Thanks,
> ToM
>
>  
> > Paulo
> >
> > ----- Original Message -----
> > From: "Tobias Meier" <[EMAIL PROTECTED]>
> > To: "Post all your questions about iText here"
> > <itext-questions@lists.sourceforge.net>
> > Sent: Monday, April 07, 2008 7:23 PM
> > Subject: Re: [iText-questions] Reuse Stamper?
> >
> >
> > >I debbuged through the code and it seems that the
> > > 'removeField' method removes the Field itself from the PDF but the
> > > reference is not removed from the field array (/Fields and then
> > > /Kids[..]).
> > > Thus when i read the file again i get an PDF.Null Object and the
> > > ids
> > > of
> > > the (removed) fields are still in the FIELDS Array but does not
> > > have
> > > an
> > > actual match...
> > >
> > > Could this be a bug or am i doing something wrong?
> > > Thanks
> > > ToM
> > >
> > >> Hi,
> > >>
> > >> i want to remove all (unsigned) signatures from an PDF.
> > >> That itself works fine but afterwards if i access the AcroForm
> > >> Object
> > >> i
> > >> always get null / Nullpointer Exception.
> > >> If i do Step 2. before Step 1. all works fine.
> > >> What is the reason for that? (Because i changed the AcroFields in
> > >> advance?).
> > >>
> > >> //1. Remove some fields (signature fields)
> > >> AcroFields acroFields = this.stamper.getAcroFields();
> > >> ArrayList al = acroFields.getBlankSignatureNames();
> > >>
> > >> for (int i = 0; i < al.size(); i++) {
> > >> acroFields.removeField((String)al.get(i));
> > >> }
> > >>
> > >> //2. Then fetch the AcroForm but a Nullpointer occurs
> > >> PRAcroForm form = this.reader.getAcroForm();
> > >> form.put(PdfName.SIGFLAGS,new PdfNumber(0));
> > >>
> > >>
> > >> So if i want to remove the signatures and then set the 'SigFlags'
> > >> how
> > >> can this be done?
> > >> And a general question: The reader can not be reused but the
> > >> stamper
> > >> can?
> > >>
> > >> Regards,
> > >> ToM
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> Monday, April 7! Use priority code J8TLD2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar


Viele Grüße,
Tobias Meier
__________________________________________________
MSc, Dipl.-Inf. Tobias Meier
Softwareentwickler
nepatec GmbH & Co. KG
Hindenburgstr. 37 . 30175 Hannover
Fon +49(0)511 935 946.51, Fax +49(0)511 935 946.57
Mailto:[EMAIL PROTECTED]
http://www.nepatec.de


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to