I'm using iTextSharp, version 3.0.9.

Sometimes I create a document, and through some combination of factors nothing 
ever gets added to that document.  When I try do call doc.Close(), I get an 
exception that the document has no pages.

I searched this mailing list and saw one relevant thread from May of 2005, 
between Paolo and a guy called Erik van Eekelen, but that thread indicated 
that the latest version would fix the problem.  Considering that my version is 
from November 2005, I wonder if maybe it was fixed in iText but not iTextSharp.

The exception occurs in PdfPages.WritePageTree(), which is called from 
PdfWriter.Close(), called from PdfDocument.Close(), from Document.Close().

if (pages.Count == 0)
                throw new IOException("The document has no pages.");

My workaround is to detect the situation and add some dummy content to the 
document, just so I can close it and clean up the file that it's attached to.



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to