Closed umairamin closed 1 year ago
This issue can be resolved by using "Config.SignificantFigures1Plus9" as shown here in class PdfWriter:
public void Write(PdfReal value) { WriteSeparator(CharCat.Character); // Ensure that value is written with decimal point. WriteRaw(value.Value.ToString(Config.SignificantFigures1Plus9, CultureInfo.InvariantCulture)); _lastCat = CharCat.Character; }
Fix will be included in the next release of PDFsharp. I cannot give an ETA now.
As of 6.0.0-preview-3 there is a fix in ScanNumber and the hack in Write is no longer needed.
Reporting an Issue Here
There appear to be a bug in PDFSharp, when a specific PDF is opened using PDF sharp then saved without any modifications, upon reopening this error occurs "System.OverflowException: 'Value was either too large or too small for an Int64.'"
I was able to determine that issue occurs because inside that PDF we had an array with this numeric value "-9223372036854775808" when PDFSharp reads the file first time it reads that value as Real Value, but upon saving the saved value is a value less than minimum value of Int64 therefore on reopening file throws an error
The original file that had this issue was confidential therefore I have generated a test file with same issue
Expected Behavior
The file should open when saved
Actual Behavior
After file is saved and we try to reopen it we get an exception
Steps to Reproduce the Behavior
Open this file using PDFSharp, save it and then try to reopen TEST_ReproduceIssue.pdf