-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect value of PDF boolean object #53
Comments
If you think there is a bug in PDFsharp then please use the IssueSubmissionTemplate to make the issue replicable. Thanks. |
To reproduce the error all the code required is following: PdfDocument pdfDoc = PdfSharp.Pdf.IO.PdfReader.Open("file.pdf"); In line 3 i am getting error: "Unexpected token 'False' in PDF stream. The file may be corrupted. If you think this is a bug in PDFsharp, please send us your PDF file." All you need is the PDF sample that i am using. But unfortunately i cant share the PDF sample with you because it is a client file. Is there any other way? |
Without "file.pdf" I cannot replicate the issue. Please let us know when you find a non-confidential PDF file that allows to replicate the issue. |
Same for me (but with "True" instead of "False").. even if I not modify nothing in the PDF just open and save the result PDF load in Google Chrome but not in Acrobat Pdf Reader (error). Like @uzair08inator say if i open the result pdf with notepad++ i can see a row with a "True" and if i modify in "true" and save than I can open the pdf with Acrobat Reader correctly. I cannot share the PDF but I can show you some rows with the "True" (the 4th line) instead of the correct "true": endobj /F 4 /P 25 0 R |
Ok, I solved modify PdfWriter.cs on line 105 making it similar to line 115. Replace: WriteRaw(value ? bool.TrueString : bool.FalseString); with: WriteRaw(value ? "true" : "false"); |
This reproduces with the attached pdf file, also available here: A full fix would include changes to Lexer.cs to include cases for both casings of true and false (line 360), as well as modifications to the four places the code references bool.TrueString / bool.FalseString. |
I am writing a PDF file using PDFSharp. For some reason the value of a boolean object is written as 'False' instead of 'false' (notice the upper case 'F')
As a result while i am reading the file again i am getting following error in PDFSharp
"Unexpected token 'False' in PDF stream. The file may be corrupted. If you think this is a bug in PDFsharp, please send us your PDF file."
PDFSharp version: Assembly PdfSharp.dll, v1.50.4740.0
The text was updated successfully, but these errors were encountered: