You didn't create this pdf with the code you posted. By the way, instead of 
FileMode.Open use FileMode.Create.

Paulo

----- Original Message ----- 
From: "Joshua Holt" <[EMAIL PROTECTED]>
To: "Post all your questions about iText here" 
<[email protected]>
Sent: Wednesday, December 12, 2007 6:38 PM
Subject: Re: [iText-questions] Expected Dict Object


Ok, so i updated to the latest iTextSharp, and i am still seeing the
error, when i try to open it.  I am on Acrobat 8 Pro, but the client
is running 7, or so I was told.  Attached is a document that i can not
open due to the error.
Thanks,
Josh

On Dec 12, 2007 11:38 AM, Paulo Soares <[EMAIL PROTECTED]> wrote:
> I can't get any error using the latest itextsharp and Acrobat 7. Reader
> 8 also works ok.
>
> Paulo
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> > Behalf Of Joshua Holt
>
> > Sent: Wednesday, December 12, 2007 4:04 PM
> > To: Post all your questions about iText here
> > Subject: Re: [iText-questions] Expected Dict Object
> >
> > Sorry about that, Here is one of the pdfs i am having issues with.
> > Thanks,
> > Josh
> >
> > On Dec 12, 2007 9:51 AM, Paulo Soares <[EMAIL PROTECTED]> wrote:
> > > Post the pdf and we'll see what's going on.
> > >
> > > Paulo
> > >
> > >
> > > > -----Original Message-----
> > > > From: [EMAIL PROTECTED]
> > > > [mailto:[EMAIL PROTECTED] On
> > > > Behalf Of Joshua Holt
> > > > Sent: Wednesday, December 12, 2007 2:39 PM
> > > > To: [email protected]
> > > > Subject: [iText-questions] Expected Dict Object
> > > >
> > > > I am trying to add an annotation to PDFs created from
> > scans.  The the
> > > > AcroForm object in the Reader is null.  How do i get around this?
> > > > Here is my code:
> > > >
> > > >
> > > >
> > > > private void AddAnnotation(string outputFile, byte[] data,
> > > > string text)
> > > >         {
> > > >
> > > >             PdfReader reader = newPdfReader( data );
> > > >          PdfStamper stamper = new PdfStamper(reader, new
> > > > FileStream(outputFile, FileMode.Open));
> > > >
> > > >             Rectangle rect = new Rectangle(200f, 25f, 400f, 40f);
> > > >
> > > >             PdfContentByte pcb =
> > newPdfContentByte(stamper.Writer);
> > > >             pcb.SetColorFill(iTextSharp.text.Color.BLACK);
> > > >
> > > >            PdfAnnotation anno =
> > > > PdfAnnotation.CreateFreeText(stamper.Writer,
> > > >                                         rect,
> > > >                                         text, pcb);
> > > >
> > > >             anno.Flags = PdfAnnotation.FLAGS_PRINT;
> > > >             anno.Color = Color.WHITE;
> > > >
> > > >             stamper.AddAnnotation(anno, 1);
> > > >
> > > >             stamper.Close();
> > > >         }
> > > > This works fine on PDFs created with acrobat, but the ones that we
> > > > have scanned in seem to get the error "Dict object
> > required" after i
> > > > atry to add the annotation.
> > > >
> > > > Any ideas?


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to