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://sourceforge.net/services/buy/index.php
_______________________________________________
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