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 

odd exception seems to turn up randomly

 
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 -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
tranquillo



Joined: 20 Sep 2007
Posts: 15

PostPosted: Thu Jan 31, 2008 12:50 pm    Post subject: odd exception seems to turn up randomly Reply with quote

I'm starting to get some trouble with some pdf documents when I try to add margins to them... it doesn't happen all the time, in fact it almost never happens... When debugging I can't see anything wrong until it throws the exception "Object reference not set to an instance of an object" when I try to use the following code:

--

// Add a new page to the output document
PdfPage page = outputDocument.AddPage(CreatePageFromSize(printSize));

XGraphics _grPage = XGraphics.FromPdfPage(page);

// Select current page from the original document
orgForm.PageNumber = i + 1;

// Create a box on the output docuement page that fits the current original document page.
XRect box = new XRect(((printSize.Width - orgForm.Page.Width) / 2), ((printSize.Height - orgForm.Page.Height) / 2), orgForm.Page.Width.Point, orgForm.Page.Height.Point);

_grPage.DrawImage(orgForm, box);

--

this is the stack trace:
at PdfSharp.Pdf.PdfObject.ImportClosure(PdfImportedObjectTable importedObjectTable, PdfDocument owner, PdfObject externalObject)
at PdfSharp.Pdf.Advanced.PdfFormXObject..ctor(PdfDocument thisDocument, PdfImportedObjectTable importedObjectTable, XPdfForm form)
at PdfSharp.Pdf.Advanced.PdfFormXObjectTable.GetForm(XForm form)
at PdfSharp.Pdf.PdfPage.GetFormName(XForm form)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.GetFormName(XForm form)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.Realize(XImage image)
at PdfSharp.Drawing.Pdf.XGraphicsPdfRenderer.DrawImage(XImage image, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawImage(XImage image, Double x, Double y, Double width, Double height)
at PdfSharp.Drawing.XGraphics.DrawImage(XImage image, XRect rect)
at vulkan.filemanager.Business.PdfLogic.AddCutMarginToDocument(String documentPath, PrintPaperFormat paperFormat) in C:\folder\file.cs:line 395


---


Could it be that pdf files from some pdf-converters lacks some attributes that pdfSharp is looking for? and which could it be? and can I add it before running it through my method?
I can't find anything in general with the pdf that could be wrong, and I haven't created it myself. All I know is in the application attribute under the pdf's document properties it says "Application: Writer"... so I don't know what application was used to create the file...
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 -> Support - 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