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

Error - Token 'xref' was not expected
https://forum.pdfsharp.net/viewtopic.php?f=2&t=879
Page 1 of 1

Author:  hmtech [ Mon Sep 21, 2009 2:59 pm ]
Post subject:  Error - Token 'xref' was not expected

I am getting this error with my pdf document.

Token 'xref' was not expected

The line of code that is throwing this error is
Using InputDoc As PdfSharp.Pdf.PdfDocument = PdfSharp.Pdf.IO.PdfReader.Open(inputPath, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import)

The file that I am using has no security and can be opened with all versions of Acrobat. If anyone has a fix for this please let me know

Author:  Thomas Hoevel [ Mon Sep 21, 2009 3:40 pm ]
Post subject:  Re: Error - Token 'xref' was not expected

hmtech wrote:
The file that I am using has no security and can be opened with all versions of Acrobat.

Can it be opened with Acrobat Reader 5.0?

AFAIK XREF and IREF are new features of Adobe 6.0 that are not yet implemented.

Save that PDF file in Adobe 5.0 format (PDF 1.4) and it should work.

Author:  hmtech [ Mon Sep 21, 2009 4:23 pm ]
Post subject:  Re: Error - Token 'xref' was not expected

Thanks Thomas.

The PDF Version is 1.3 and The PDF Producer is Acrobat Distiller 5.0.5 (Windows)

I have not yet tried opening with Acrobat 5.0 ans I have Acrobat 8.0 installed on my machine.

Author:  hmtech [ Tue Sep 22, 2009 6:45 pm ]
Post subject:  Re: Error - Token 'xref' was not expected

I tried working with another dll and that one is throwing this error.

'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'

Something is definitely wrong with my pdf. Does this error tell anything about the file?

Author:  Thomas Hoevel [ Wed Sep 23, 2009 8:01 am ]
Post subject:  Re: Error - Token 'xref' was not expected

hmtech wrote:
Does this error tell anything about the file?

No.

And "PdfSharp.Pdf.IO.PdfReader.Open" is only the entry point - the error occurs deep down in another routine, so this doesn't say much about the error either.

If there are errors in the file: if you open the file with Adobe Acrobat (not the Reader) and close it, and if Acrobat then prompts to save changes it has fixed some errors. Then you should save the file and try again.

Author:  hmtech [ Fri Jan 29, 2010 4:14 pm ]
Post subject:  Re: Error - Token 'xref' was not expected

"if you open the file with Adobe Acrobat (not the Reader) and close it, and if Acrobat then prompts to save changes it has fixed some errors. Then you should save the file and try again"

Is there a way to do this programmatically?

Thanks

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