Hi All,
I'm getting a PdfSharp.Pdf.IO.PdfReaderException: Token '6' was not expected.
The PDF I'm reading opens up fine in my PDF reader software, so I don't think it's corrupted.
It happens in PdfReader.Open, at this bit (marked *** HERE ***):
Code:
// Read all indirect objects.
for (int idx = 0; idx < count; idx++)
{
PdfReference iref = irefs[idx];
if (iref.Value == null)
{
try
{
Debug.Assert(document._irefTable.Contains(iref.ObjectID));
PdfObject pdfObject = parser.ReadObject(null, iref.ObjectID, false, false); *** HERE ***
Debug.Assert(pdfObject.Reference == iref);
pdfObject.Reference = iref;
Debug.Assert(pdfObject.Reference.Value != null, "Something went wrong.");
It appears to be choking on the '6 0 obj' line below, expecting an 'endobj' before it.
I'm not familiar enough with the PDF spec to know if this is a correctly formed PDF, but the fact that my reader software happily opens it would suggest that this construct should be supported.
Code:
stream
q 409 0 0 291 0 0 cm /x9 Do Q
endstream
endobj
11 0 obj
32
endobj
5 0 obj
<< /Type /Font
/Subtype /Type1
/Name /f-0-0
/BaseFont /Helvetica-Bold
/Encoding /WinAnsiEncoding
>>
6 0 obj
<< /Type /Font
/Subtype /Type1
/Name /f-1-0
/BaseFont /Helvetica
/Encoding /WinAnsiEncoding
>>
1 0 obj
<< /Type /Pages
/Kids [ 8 0 R ]
/Count 1
>>
endobj
12 0 obj
<< /Creator (Win2PDF)
/Producer (Win2PDF x64 7.6.0 - 2.6.7.1484.3 http://www.win2pdf.com)
/Title (Unnamed Ironbark Document)
/Author (Perth.admin)
/Subject ()
/Keywords ()
>>
endobj
13 0 obj
<< /Type /Catalog
/Pages 1 0 R
>>
endobj
thanks for your time.
Ben McIntyre