I am trying to output a PDF using byte stream (iTextSharp 5), but the
DirectContent member of PdfWriter is empty. Am I accessing it at the
wrong time? This code is in the constructor of my worksheet class:

 

            Document document = new Document(PageSize.A4, 36, 36, 36 +
189, 36);

 

                bodyTable = new PdfPTable(1); 

                PdfWriter pw = PdfWriter.GetInstance(document, new
FileStream(stringname + ".pdf", FileMode.Create));

                pw.InitialLeading = 16; //to make space for the header
on each page

                pw.PageEvent = e;

                document.Open();

 

                document.Add(new PdfPTable(1)); //content

                document.Add(new PdfPTable(1)); //content

                document.Add(new PdfPTable(1));  //content

 

                byteStream = pw.DirectContent.ToPdf(pw);

 

                document.Close();

            

      

Thanks in advance!




BMIC Disclaimer: 
 
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.  If
you have received this email in error please notify the system manager.  Please
note that any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of the company.  Finally, the
recipient should check this email and any attachments for the presence of
viruses. The company accepts no liability for any damage caused by any virus
transmitted by this email.
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.itextpdf.com/book/
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