PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
XImage FromGdiPlusImage http://forum.pdfsharp.de/viewtopic.php?f=2&t=1494 |
Page 1 of 1 |
Author: | dcowan [ Fri Jan 07, 2011 12:16 am ] |
Post subject: | XImage FromGdiPlusImage |
I'm evaluating PDFsharp as a replacement to our usage of Crystal Reports as the latter is simply too buggy and bloated. So far things are looking VERY good! I have some System.Drawing.Bitmap objects in my C# application that I'm converting to XImage objects and placing on a PdfPage object. This is working well. I'm using the following code to do the conversion: BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap( myBitmap.GetHbitmap(), System.IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); XImage newImage = XImage.FromBitmapSource(bitmapSource); However looking at the help, documentation, and source code to PDFsharp I think I should be able to do this simply like this: XImage newImage = XImage.FromGdiPlusImage(myBitmap as Image); The problem is FromGdiPlusImage does not appear as an available method for XImage. This is puzzling as I see it in the source code and the options GDI;UseGdiObjects are in fact defined in the solution when I build the resultant PdfSharp.dll which I'm referencing from my application. I'm certainly doing something wrong? Regards, Dick |
Author: | dcowan [ Mon Jan 17, 2011 9:18 pm ] |
Post subject: | Resolved: XImage FromGdiPlusImage |
This issue has been resolved. I knew it would be something stupid I was doing. The reference in my project was using the WPF version of the PDFsharp DLL instead of the GDI version. Making the change fixed the problem. At least I now know how to accomplish the same under either version now. Dick |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |