There is a crash in PdfSharp when appending some of my PDF files to a longer master file. Attached is a minimum working sample that triggers this bug. Stacktrace is as follows:
Unhandled Exception: System.InvalidCastException: GetReal: Object is not a number. at PdfSharp.Pdf.PdfArray.ArrayElements.GetReal(Int32 index) at PdfSharp.Pdf.PdfDictionary.DictionaryElements.GetRectangle(String key, Boolean create) at PdfSharp.Pdf.PdfPage.get_MediaBox() at PdfSharp.Pdf.PdfPage.WriteObject(PdfWriter writer) at PdfSharp.Pdf.PdfDocument.DoSave(PdfWriter writer) at PdfSharp.Pdf.PdfDocument.Save(Stream stream, Boolean closeStream) at PdfSharp.Pdf.PdfDocument.Save(String path) at IssueSubmission.Program.Main() in C:\Users\user\Downloads\PDFsharp-IssueSubmission\IssueSubmission\Program.cs:line 38
File is generated with WeasyPrint and sanitized with PDF-Xchange editor. Original WeasyPrint file doesn't work as well as sanitized version from PDF-Xchange.
Hello Everyone
There is a crash in PdfSharp when appending some of my PDF files to a longer master file. Attached is a minimum working sample that triggers this bug. Stacktrace is as follows:
Unhandled Exception: System.InvalidCastException: GetReal: Object is not a number. at PdfSharp.Pdf.PdfArray.ArrayElements.GetReal(Int32 index) at PdfSharp.Pdf.PdfDictionary.DictionaryElements.GetRectangle(String key, Boolean create) at PdfSharp.Pdf.PdfPage.get_MediaBox() at PdfSharp.Pdf.PdfPage.WriteObject(PdfWriter writer) at PdfSharp.Pdf.PdfDocument.DoSave(PdfWriter writer) at PdfSharp.Pdf.PdfDocument.Save(Stream stream, Boolean closeStream) at PdfSharp.Pdf.PdfDocument.Save(String path) at IssueSubmission.Program.Main() in C:\Users\user\Downloads\PDFsharp-IssueSubmission\IssueSubmission\Program.cs:line 38
File is generated with WeasyPrint and sanitized with PDF-Xchange editor. Original WeasyPrint file doesn't work as well as sanitized version from PDF-Xchange.
PDFsharp-IssueSubmission.zip