Didstopia / PDFSharp

A .NET Standard 2.0 library for reading, writing and editing PDF files.
MIT License
52 stars 18 forks source link

add alternate signatures from XImage.FromFile and XImage.FromStream #36

Closed MiniverCheevy closed 5 years ago

MiniverCheevy commented 5 years ago

Using your library in conjunction with Connatix/MigraDoc I recieved the following missing method exceptions

An exception of type 'System.MissingMethodException' occurred in MigraDoc.Rendering.Standard.dll but was not handled in user code Additional information: Method not found: 'Didstopia.PDFSharp.Drawing.XImage Didstopia.PDFSharp.Drawing.XImage.FromFile(System.String)'. occurred

An exception of type 'System.MissingMethodException' occurred in MigraDoc.Rendering.Standard.dll but was not handled in user code Additional information: Method not found: 'Didstopia.PDFSharp.Drawing.XImage Didstopia.PDFSharp.Drawing.XImage.FromStream(System.Func`1)'. occurred

I would expect

XImage FromFile(string path)

and

XImage FromFile(string path, bool? isJepg = true)

to work interchangeably, but that doesn't seem to be the case.

I've broken the methods I'm having issues with into two methods, one of which has the signature needed in Connatix/MigraDoc. I believe that the code is functionally equivalent, and all of the existing tests pass.

Dids commented 5 years ago

Looks good to me. Thank you for the PR!