PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Using PDFSharp with Xamarin Forms Project can't DrawImage
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3721
Page 1 of 1

Author:  JustDave [ Fri Jan 26, 2018 7:56 pm ]
Post subject:  Using PDFSharp with Xamarin Forms Project can't DrawImage

I'm using PDFSharp to create PDF files for printing. all is going well with the exception of drawimage where the image is not an embedded resource. Draw image works fine with embeeded resource such as the "Frogs.jpg" file in the demo. but throughs exception when the image came from a .jpg file from the device.

doesn't matter whether I created the XImage with fromfile or fromstream, the image will say its a "{PdfSharp.Drawing.XImage}", but with the exception of horizontal and verticle resolution (both say 96) all other debugger members say "System.NullReferenceException: Object reference not set to an instance of an object.".
no exceptions from the image load.

when I call the DrawImage I get exception:
{System.NullReferenceException: Object reference not set to an instance of an object.
at PdfSharp.Drawing.XImage.AsJpeg () [0x00007]

Has anybody encountered this before?
Anybody have any suggestions for solution?

I can make a Helloworld sln if need be, but I had the same problem with the "PDFSharp" demo.

Currently trying this in android test.

Thanks in advance for any assistance.

Author:  TH-Soft [ Fri Jan 26, 2018 8:41 pm ]
Post subject:  Re: Using PDFSharp with Xamarin Forms Project can't DrawImag

Hi!
JustDave wrote:
Currently trying this in android test.
The original PDFsharp version does not support Xamarin or Android.
It seems you are using an unofficial port that is not supported on this site.

If you can replicate the issue with the Issue Submission Template and the latest NuGet packages (currently 1.50 beta5) then we will have a look.

Author:  JustDave [ Mon Jan 29, 2018 3:49 pm ]
Post subject:  Re: Using PDFSharp with Xamarin Forms Project can't DrawImag

Thank you for your response Thomas. And once again, (based on reading prior post) this turned out to be not an issue with PDFSharp but the file holding the Image. I had gotten corrupted in the transport process going to the device. I modified that process and now it works fine.

If its an after market port then they did a fine job and from my experience so far PDFSharp is a fine product.

Thanks again.

Author:  Bubla [ Fri Apr 27, 2018 3:18 pm ]
Post subject:  Re: Using PDFSharp with Xamarin Forms Project can't DrawImag

I have the same problem
XImage.FromFile(path) make exception "Object reference not set to an instance of an object."
XImage.ExistsFile(path) return false.
Parameter path is correct, the file exists.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/