使用PDF Clown编写PDF错误

时间:2018-02-07 13:24:14

标签: pdf pdfclown

我有一个PDF文件,我正在使用PDF Clown阅读,然后添加一些注释。之后,我尝试使用org.pdfclown.files.File的Save方法将文件序列化到磁盘。这样做我得到以下错误

  

运行示例时发生异常:   org.pdfclown.util.parsers.PostScriptParseException:未知类型开头:'False'      在org.pdfclown.tokens.BaseParser.ParsePdfObject()的d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ tokens \ BaseParser.cs:第149行      在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ tokens \ FileParser.cs中的org.pdfclown.tokens.FileParser.ParsePdfObject():第150行      在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ tokens \ FileParser.cs中的org.pdfclown.tokens.FileParser.ParsePdfObject(XRefEntry xrefEntry):第221行      在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ objects \ PdfIndirectObject.cs中的org.pdfclown.objects.PdfIndirectObject.get_DataObject():第275行      at org.pdfclown.objects.PdfIndirectObject.WriteTo(IOutputStream stream,File context)在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ objects \ PdfIndirectObject.cs:line 248      at org.pdfclown.tokens.PlainWriter.WriteStandard()在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ tokens \ PlainWriter.cs:第205行      在org.pdfclown.tokens.Writer.Write(SerializationModeEnum模式)的d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ tokens \ Writer.cs:第132行      at org.pdfclown.files.File.Save(IOutputStream stream,SerializationModeEnum mode)在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ files \ File.cs:第315行      at org.pdfclown.files.File.Save(String path,SerializationModeEnum mode)在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.lib \ src \ org \ pdfclown \ files \ File.cs:第272行      at org.pdfclown.samples.cli.HelloWorldSample.UzairTestFunc()在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.samples.cli \ src \ org \ pdfclown \ samples \ cli \ HelloWorldSample.cs:第40行      at org.pdfclown.samples.cli.HelloWorldSample.Run()在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.samples.cli \ src \ org \ pdfclown \ samples \ cli \ HelloWorldSample.cs:第20行      at org.pdfclown.samples.cli.SampleLoader.Run(String inputPath,String outputPath)在d:\ eProof \ testProjects \ pdf_clown_svn \ dotNET \ pdfclown.samples.cli \ src \ org \ pdfclown \ samples \ cli \ SampleLoader.cs :第123行

现在我无法在这里分享PDF,但我发现它无法处理PDF中的以下对象 ...
96 0 obj

endobj
...

如何在PDF Clown中解决此问题?

1 个答案:

答案 0 :(得分:1)

96 0 obj
False
endobj

此对象无效,布尔值全部小写:

  

7.3.2布尔对象

     

布尔对象表示true和false的逻辑值。它们使用关键字 true false 显示在PDF文件中。

(ISO 32000-1和ISO 32000-2)

因此,要修复PDF,请将False替换为false