PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 3:29 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Jun 01, 2017 3:24 pm 
Offline

Joined: Thu Jun 01, 2017 3:03 pm
Posts: 2
Hello everyone! I hope this hasn't already been answered elsewhere, but my search hasn't revealed anything, so I apologize if this is a duplicate question.

I have a PDF that was generated from a Word file, and created through Foxit. When I try to open it with PDFsharp, I get the following error:

Code:
Unexpected character '0x0029' in PDF stream. The file may be corrupted. If you think this is a bug in PDFsharp, please send us your PDF file.


The character in question is the right parenthesis, ).

This happens no matter what PdfDocumentOpenMode I specify. It is unprotected, and regardless of whether or not I specify an empty password, the result is the same.

I am using PDFsharp 1.50-beta3, and I have applied pdfsharp-689-patch to Parser.cs, but that didn't seem to make a difference. I poked around in Lexer.cs and that seems to be where it is choking, but I'm not very familiar with PDFsharp's internals, so I could be mistaken.

I would be more than happy to submit the PDF for your research if necessary, but I would prefer to send it privately. The document reveals some of my employer's internal network structures and I would prefer that not be made public.

Please let me know if I can or need to send the PDF, and if so where.

Thank you for your time!


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 07, 2017 1:59 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!

Sorry for the late response, but I had a day off on Friday, there was a bank holiday on Monday, and urgent tasks from the boss on Tuesday.

As far as I can tell the file is corrupt.

Adobe Reader shows an error when I invoke File => Save as.

The problem is here:
Code:
49 0 obj
<<
/F (https://en.wikipedia.org/wiki/Shebang_\(Unix))
/S /Launch
>>

They added "\" before "(" but forgot the "\" before the ")" contained in the string.
With balanced parentheses, the backslashes are not needed - but one "\" is wrong, either use two or none for this link.

Adobe Reader ignores this problem when you just open the PDF, but it throws an error on Save as.

Using a binary editor, I changed the link to "Shebang__(Unix)". Now both PDFsharp and Adobe Reader can handle the file without problems (but the link no longer works).

So maybe your problem is solved if you patch the file with a binary editor (I used Visual Studio).
Or change the link, escaping the parentheses with %29 and create the document again.

Maybe report the problem to Foxit so they can fix it.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jun 07, 2017 2:36 pm 
Offline

Joined: Thu Jun 01, 2017 3:03 pm
Posts: 2
Understood! I'll be sure to let Foxit know. I've got a lot to gripe to them about already. Haha. Thanks for the help!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 177 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group