Hello 

i'm using page events and i get 

"Not all annotations could be added to the document (the document doesn't
have enough pages)."

when issuing the:

            document.Close();

This happened after adding :

 public override void OnStartPage(PdfWriter writer, Document doc)
        {
           
//----------------------------------------------------------------
            BaseColor grey = new BaseColor(128, 128, 128);
            Font font = FontFactory.GetFont("Arial", 9, Font.NORMAL, grey);
            PdfPTable headerTbl = new PdfPTable(1);
            headerTbl.TotalWidth = doc.PageSize.Width;
            //img header

            //iTextSharp.text.Image head =
iTextSharp.text.Image.GetInstance(HttpContext.Current.Server.MapPath("header.jpg"));

            iTextSharp.text.Image head =
iTextSharp.text.Image.GetInstance(@"C:\studiando_multilang\TEMP\studiando_compattattore\bin\Debug\mega_logo_ABCtribe.com_99x25.png");
            head.Annotation = new Annotation(0, 0, 0, 0,
"http://abctribe.com/";);

            head.ScalePercent(80);

            headerTbl.HorizontalAlignment = Element.ALIGN_CENTER;
            PdfPCell cell = new PdfPCell(head);
            cell.HorizontalAlignment = Element.ALIGN_CENTER;
            cell.Border = 0;
            headerTbl.AddCell(cell);



            //this is for the position of the header ... im my case is "+80"
            //headerTbl.WriteSelectedRows(0, -1, 0, (doc.TopMargin + 3),
writer.DirectContent);
            Rectangle pageSize = doc.PageSize;
            headerTbl.WriteSelectedRows(0, -1, pageSize.GetLeft(40),
pageSize.GetTop(50),  writer.DirectContent);
           
//----------------------------------------------------------------

        }


OnEndPage is similar and when only OnStartPage is in the code everything
works ok.
What i'm missing?
thanks

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Not-all-annotations-could-be-added-to-the-document-the-document-doesn-t-have-enough-pages-tp4076357p4076357.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to