I am just opening a PDF, type a text and save to a new file!
With some files it work but with others I get this error:
"Unhandled Exception: System.FormatException: The DateTime represented by the str
ing is not supported in calendar System.Globalization.GregorianCalendar.
at it.stefanochizzolini.clown.files.File.WriteTo(IOutputStream stream, Serial
at it.stefanochizzolini.clown.files.File.WriteTo(String path, SerializationMo
at main(String args) in ..."
Any ideas ?
could you please send me (if it doesn't hurt your privacy) one of such PDF files along with the code you used to produce this error so that I'm able to reproduce it?
See my personal info page  to get my email address.
OK. Of course!
my code: http://www.geocities.com/nad_af9/pdf_clown/Program.txt
my PDF: http://www.geocities.com/nad_af9/pdf_clown/TestDocument.pdf
NOTE: This occurs when using STANDARD serialization only, with INCREMENTAL, it works 100% fine.
Your error is caused by parsing the following entry within the Information dictionary of your PDF file:
which reads as "January 1, 0000, midnight, UTC".
The problem is that it collides with an implementation limitation of the DateTime structure  in the context of the GregorianCalendar class  of the .NET Framework which states that date representation is limited to "values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.)": to say that January 1, 0000 (your date) is OUT of range!
If you get a try to the Java implementation of PDF Clown, you'll find that it deals successfully with your PDF file instead.
I couldn't find implementation notes about dates in the PDF spec, but opening your PDF file with Adobe Reader 8 I curiously got "01/01/1900 12:00:00 AM" as the representation of your date in the "Document properties" window...
It's quite evident that your date is semantically wrong, but I'll consider dealing with such an exceptional case (out-of-range dates) in the next releases, to let PDF Clown's execution survive.
I located the source code in .NET and handled the exception manually since PDF documents might have incorrect creation date. Anyway, I send you a link to the hotfix - you can consider this for your future release.
[ PdfDate.cs ] - http://www.geocities.com/nad_af9/PdfDate.txt
Also, It would be great if you can improve PDF Clown documentation. It is not friendly at all; I just learnt from your examples.
I agree with you, Nadeem: its documentation is currently way too sketchy... I'll revise it for the next release.
In the meantime, users' feedback will be invaluable to focus their actual informative needs, so I warmly ask anybody interested to brainstorm ideas about hot topics regarding the use of PDF Clown.
Log in to post a comment.