PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Exception opening PDF Document
https://forum.pdfsharp.net/viewtopic.php?f=3&t=81
Page 1 of 1

Author:  Brian Pickles [ Mon Feb 19, 2007 3:18 pm ]
Post subject:  Exception opening PDF Document

Hi,

Your software is impressive and easy to use. It has been working well.

Unfortunately I am now getting a 'Not implemented; unknown escape character.' exception.

at Lexer.ScanLiteralString()
at Lexer.ScanNextToken()
at Parser.ScanNextToken()
at Parser.ParseObject(Symbol Stop)
at Parser.ReadArray(PdfArray array, Boolean includeReference)
at Parser.ReadObject(PdfObject pdfObject, OdfObjectID objectID, Boolean includeReference)
at PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
...........

The PDF file can be a single page or multiple pages. All the PDF files that cause this problem are created on different XP PRO SP2 (32bit edition) machines by printing from Microsoft Publisher 2000 using CutePDF Writer 2.7.

I can send you a single page PDF file that causes the problem if it helps.

Interestingly, the PDF file can be processed by PDFSharp if it is created on XP (64bit edition) by printing the same Publisher file using Microsoft Publisher 2003 with the same version of CutePDF Writer - 2.7.

All the PDF files that cause an exception in PDFSharp can be opened successfully in Adobe Reader 8.

Don't know if this is a bug in PDFSharp or CutePDF and I do not know enough about the PDF format to investigate further.

Is there any chance this can be fixed in PDFSharp, if not can you provide further information so that I can talk to Cute PDF.

Many thanks for any help you can provide.

Brian

Author:  Brian Pickles [ Mon Feb 19, 2007 5:11 pm ]
Post subject:  Exception opening PDF Document

Hi,

More info - problem seems to be when the Publisher document includes GIF's.

Author:  Thomas Hoevel [ Tue Feb 20, 2007 5:42 pm ]
Post subject: 

Do you get an exception or an assertion?
Assertions only occur with debug builds.

I'm not sure if we fixed this with current internal builds of PDFsharp.

If you send me a file via PM or publish the download location here, I will test it with a current build.

Author:  Thomas Hoevel [ Wed Feb 28, 2007 4:27 pm ]
Post subject: 

I can replicate the assertion (it's not an exception).
Our experts will have to take a look at that.
Should be fixed with the next release.

Author:  Thomas Hoevel [ Fri Mar 02, 2007 9:08 am ]
Post subject: 

Hi!
We have fixed this bug.

Here's the solution for lexer.cs (line 543):
Code:
                  default:
                    if (char.IsDigit(ch))
                    {
#if true
                      // Octal character code
                      int n = ch - '0';
                      if (Char.IsDigit(this.nextChar))
                      {
                        n = n * 8 + ScanNextChar() - '0';
                        if (Char.IsDigit(this.nextChar))
                          n = n * 8 + ScanNextChar() - '0';
                      }
                      ch = (char)n;
#else
                      //TODO
                      Debug.Assert(false, "Not implemented; unknown escape character.");
#endif
                    }
                    break;


Will be fixed in the next release (which is not scheduled yet).
Thank you, Brian, for your PDF file.

Author:  Brian Pickles [ Fri Mar 02, 2007 10:45 am ]
Post subject: 

Have added your patch and we can now process the PDF file which had the error.

That's great support. Thank you very much. It is much appreciated.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/