PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Trouble with PDFs generated by Scribus https://forum.pdfsharp.net/viewtopic.php?f=3&t=443 |
Page 1 of 1 |
Author: | rudib [ Mon Aug 04, 2008 2:03 pm ] |
Post subject: | Trouble with PDFs generated by Scribus |
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! |
Author: | Stefan Lange [ Mon Aug 04, 2008 10:20 pm ] |
Post subject: | |
Hi, you found a serious bug. Scribus uses a rare way of resource inheritance, which was yet not correctly handled in PDFsharp. Fix InheritValues in PdfPage.cs. Code: internal static void InheritValues(PdfDictionary page, InheritedValues values)
... if (res is PdfReference) { resources = (PdfDictionary)((PdfReference)res).Value.Clone(); resources.Document = page.Owner; // <<<<<<<<<< } else resources = (PdfDictionary)res; if (resources == null) { resources = values.Resources.Clone(); resources.Document = page.Owner; // <<<<<<<<<< page.Elements.Add(PdfPage.Keys.Resources, resources); }... Regards |
Author: | rudib [ Tue Aug 05, 2008 9:55 am ] |
Post subject: | |
Thanks for the quick reply, this fixes our problems. Many thanks. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |