Hi,
Here's a little project with a sample document exported from Scribus with PDF 1.3-1.5 output settings.
http://zoidberg.whiletrue.com/rudi/PDFS ... busBug.zip
Output from my machine:
Code:
test_pdf_1.3.pdf
System.NullReferenceException: Object reference not set to an instance of an object.
at PdfSharp.Pdf.Advanced.PdfResources.AddFont(PdfFont font)
at PdfSharp.Drawing.Pdf.PdfGraphicsState.RealizeFont(XFont font, XBrush brush, Int32 renderMode)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.Realize(XFont font, XBrush brush, Int32 renderMode)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawString(String s, XFont font, XBrush brush, XRect rect, XStringFormat format)
at PdfSharp.Drawing.XGraphics.DrawString(String text, XFont font, XBrush brush, XRect layoutRectangle, XStringFormat format)
at PdfSharp.Drawing.XGraphics.DrawString(String s, XFont font, XBrush brush, Double x, Double y, XStringFormat format)
at PDFSharpScribusBug.Program.Main(String[] args) in c:\code\pdfsharp_bug\PDFSharpScribusBug\Program.cs:line 30
test_pdf_1.4.pdf
System.NullReferenceException: Object reference not set to an instance of an object.
at PdfSharp.Pdf.Advanced.PdfResources.AddExtGState(PdfExtGState extGState)
at PdfSharp.Drawing.Pdf.PdfGraphicsState.RealizeBrush(XBrush brush, PdfColorMode colorMode)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawRectangle(XPen pen, XBrush brush, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawRectangle(XBrush brush, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawRectangle(XBrush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at PDFSharpScribusBug.Program.Main(String[] args) in c:\code\pdfsharp_bug\PDFSharpScribusBug\Program.cs:line 24
test_pdf_1.5.pdf
System.NullReferenceException: Object reference not set to an instance of an object.
at PdfSharp.Pdf.Advanced.PdfResources.AddExtGState(PdfExtGState extGState)
at PdfSharp.Drawing.Pdf.PdfGraphicsState.RealizeBrush(XBrush brush, PdfColorMode colorMode)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawRectangle(XPen pen, XBrush brush, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawRectangle(XBrush brush, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawRectangle(XBrush brush, Int32 x, Int32 y, Int32 width, Int32 height)
at PDFSharpScribusBug.Program.Main(String[] args) in c:\code\pdfsharp_bug\PDFSharpScribusBug\Program.cs:line 24
We haven't been able to find a workaround yet (export settings or anything else). Debugging PDFSharp uncovered that this.Owner is null for these PDFDictionaries which obviously shouldn't be the case.
The project is bundled with PDFSharp 1.2, also crashes on 1.0.
Thanks!