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

Non-negative number required - compressed object
http://forum.pdfsharp.net/viewtopic.php?f=3&t=3567
Page 1 of 1

Author:  suresh.kau05 [ Fri Apr 07, 2017 12:06 pm ]
Post subject:  Non-negative number required - compressed object

Hi Team,

We are using PdfSharp 1.3 version, while processing the PDF file we are getting error "Non-negative number required".
So to check the issue we have downloaded the latest version 1.5 beta 3 and checking in debug mode.

I am getting this issue while reading the below code when it tries to read the indirect objects from the PDF file.
File Name: PdfReader.cs

PdfReference[] irefs = document._irefTable.AllReferences

PdfReference iref = irefs[idx];
if (iref.Value == null)

Getting the below error message:

Exception message: Non-negative number required.
Parameter name: value

Observation while debugging the source code, I found in the below section of

// 3rd: Create iRefs for all compressed objects.
PdfCrossReferenceStream.CrossReferenceStreamEntry item = xrefStream.Entries[idx2];

// Is type xref to compressed object?
if (item.Type == 2)
{
// Here it is adding the null value in the dictionary object named "objectStreams"
}

Please find below stack trace details:

at System.IO.FileStream.set_Position(Int64 value)
at PdfSharp.Pdf.IO.Lexer.set_Position(Int32 value) in ..\PDFsharp\src\PdfSharp\Pdf.IO\Lexer.cs:line 71
at PdfSharp.Pdf.IO.Parser.MoveToObject(PdfObjectID objectID) in ..\PDFsharp\src\PdfSharp\Pdf.IO\Parser.cs:line 80
at PdfSharp.Pdf.IO.Parser.ReadObject(PdfObject pdfObject, PdfObjectID objectID, Boolean includeReferences, Boolean fromObjecStream) in ..\PDFsharp\src\PdfSharp\Pdf.IO\Parser.cs:line 121
at PdfSharp.Pdf.IO.Parser.GetStreamLength(PdfDictionary dict) in ..\PDFsharp\src\PdfSharp\Pdf.IO\Parser.cs:line 333
at PdfSharp.Pdf.IO.Parser.ReadObject(PdfObject pdfObject, PdfObjectID objectID, Boolean includeReferences, Boolean fromObjecStream) in ..\PDFsharp\src\PdfSharp\Pdf.IO\Parser.cs:line 263
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider) in ..\PDFsharp\src\PdfSharp\Pdf.IO\PdfReader.cs:line 430

Please find attached file for More Information.

Please help to sort out the issue with the PDFsharp 1.5 beta version.

Thanks & Regards,
Suresh

Attachments:
File comment: Source File Name: Parser.cs
PdfObjectStream Error.png
PdfObjectStream Error.png [ 75.44 KiB | Viewed 763 times ]

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