Search code examples
pdfpdfclown

PDF write error using PDF Clown


I have a PDF file which i am reading using PDF Clown and then adding some annotations to it. After that i am trying to serialize the file to disk using Save method of org.pdfclown.files.File. In doing so i am getting following error

An exception happened while running the sample: org.pdfclown.util.parsers.PostScriptParseException: Unknown type beginning: 'False' at org.pdfclown.tokens.BaseParser.ParsePdfObject() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\tokens\BaseParser.cs:line 149 at org.pdfclown.tokens.FileParser.ParsePdfObject() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\tokens\FileParser.cs:line 150 at org.pdfclown.tokens.FileParser.ParsePdfObject(XRefEntry xrefEntry) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\tokens\FileParser.cs:line 221 at org.pdfclown.objects.PdfIndirectObject.get_DataObject() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\objects\PdfIndirectObject.cs:line 275 at org.pdfclown.objects.PdfIndirectObject.WriteTo(IOutputStream stream, File context) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\objects\PdfIndirectObject.cs:line 248 at org.pdfclown.tokens.PlainWriter.WriteStandard() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\tokens\PlainWriter.cs:line 205 at org.pdfclown.tokens.Writer.Write(SerializationModeEnum mode) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\tokens\Writer.cs:line 132 at org.pdfclown.files.File.Save(IOutputStream stream, SerializationModeEnum mode) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\files\File.cs:line 315 at org.pdfclown.files.File.Save(String path, SerializationModeEnum mode) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.lib\src\org\pdfclown\files\File.cs:line 272 at org.pdfclown.samples.cli.HelloWorldSample.UzairTestFunc() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.samples.cli\src\org\pdfclown\samples\cli\HelloWorldSample.cs:line 40 at org.pdfclown.samples.cli.HelloWorldSample.Run() in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.samples.cli\src\org\pdfclown\samples\cli\HelloWorldSample.cs:line 20 at org.pdfclown.samples.cli.SampleLoader.Run(String inputPath, String outputPath) in d:\eProof\testProjects\pdf_clown_svn\dotNET\pdfclown.samples.cli\src\org\pdfclown\samples\cli\SampleLoader.cs:line 123

Now i cant share the PDF here, but i see that it is not able to handle the following object in the PDF
...
96 0 obj
False
endobj
...

Any ideas how to resolve this in PDF Clown?


Solution

  • 96 0 obj
    False
    endobj
    

    This object is invalid, boolean values are all lowercase:

    7.3.2 Boolean objects

    Boolean objects represent the logical values of true and false. They appear in PDF files using the keywords true and false.

    (both ISO 32000-1 and ISO 32000-2)

    To repair your PDF, therefore, please replace False by false.