PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Apr 16, 2024 4:41 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Tue Aug 09, 2016 1:34 pm 
Offline

Joined: Tue Aug 09, 2016 1:22 pm
Posts: 1
https://postimg.org/image/cvyocfg0r/
I have a set of images that I'm trying to convert from images to PDF. This one in particular is giving me a hard time (attached)

When I try to code the following to convert it to PDF, I get IndexOutOfBoundsException which is fine. The problem is that I cannot catch the exception as it appears to get swallowed in the drawimage, and so I'm left with a PDF that has created 23 of the 40 or so images and I'm left not knowing there was ever an issue in the release version of the program since I only see the error during debugging. I should at least be able to catch the error and do something with it.

Code:
try
                                    {
                                        XGraphics xgr = XGraphics.FromPdfPage(myDoc.Pages[i]);

                                        using (XImage img = XImage.FromFile(myArray[i]))
                                        {
                                            try
                                            {
                                                xgr.DrawImage(img, 0, 0);
                                            }
                                            catch (Exception ex)
                                            {
                                                //Log the problem and stop trying to create PDF.
                                            }
                                           
                                        }


Top
 Profile  
Reply with quote  
PostPosted: Tue Aug 09, 2016 2:01 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 340
Hi!

I tested your image with the WPF build of PDFsharp 1.50 - and everything worked fine without exception.

Please provide further information to make the problem reproducible.

See also:
viewtopic.php?f=2&t=832

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 61 guests


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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group