Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am getting
rebuild failed: value was either too large or too small for an int32.; original message: value was either too large or too small for an int32.
While tring to read the pdf file using
ITextSharp
Pdfreader in C# MVC.

Below is my code,
PdfReader pdfReader = new PdfReader(fileName);


Help to solve this issue. I am only getting this issue for specific documents. But I am able to load the same document in Adobe Arcobat Document.
Thanks,
Baskar G

What I have tried:

PdfReader pdfReader = new PdfReader(fileName);
Posted
Updated 1-Mar-19 8:06am
Comments
Richard MacCutchan 1-Mar-19 9:58am    
The message is quite clear. You are trying to put a value into an int field that is too large. You need to use your debugger to find out where this occurs in your code, and correct it.
MadMyche 1-Mar-19 11:32am    
What version of iTextSharp are you using? Does it work with other PDFs? What size is the file in question (disc space and pages)?

1 solution

Since you are only getting it with "specific documents", it's obvious there is "something" in THOSE documents that ITextSharp cannot handle.

Expecting the community to solve this particular problem given the available information is impossible.

You need to figure out yourself what is "different" about these documents (from the ones that "work").

(Or, change the int32 to an int64 and deal with the consequences of that).
 
Share this answer
 
Comments
MadMyche 1-Mar-19 15:13pm    
.... I thinkx the problem is actually thrown in the iTextSharp package, that error seems to match the GIT source code
throw new invalidPdfException(MessageLocalization.GetComposedMessage("rebuild.failed...");
Richard Deeming 5-Mar-19 13:45pm    
You'll need to report this as a bug on the GitHub repo. You'll need to provide them with a copy of a document that triggers the bug, and the sample code to reproduce it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900