PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trouble with PDFs generated by Scribus

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
rudib



Joined: 04 Aug 2008
Posts: 2

PostPosted: Mon Aug 04, 2008 2:03 pm    Post subject: Trouble with PDFs generated by Scribus Reply with quote

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/PDFSharpScribusBug.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!
Back to top
View user's profile Send private message
Stefan Lange



Joined: 12 Oct 2006
Posts: 47
Location: Cologne, Germany

PostPosted: Mon Aug 04, 2008 10:20 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
rudib



Joined: 04 Aug 2008
Posts: 2

PostPosted: Tue Aug 05, 2008 9:55 am    Post subject: Reply with quote

Thanks for the quick reply, this fixes our problems. Many thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Bug Reports - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com