peters / xps2img

Convert xps document to a .NET bitmap
GNU Lesser General Public License v3.0
21 stars 12 forks source link

Remove OutOfMemoryException retries for RenderPageToBitmap. #2

Closed i2van closed 10 years ago

i2van commented 10 years ago

https://github.com/peters/xps2img/blob/master/src/xps2img/Xps2Image.cs

private RenderTargetBitmap RenderPageToBitmap(DocumentPage page, RenderTargetBitmap bitmap)

For a library it makes no sense to keep trying on OutOfMemoryException (makes sense for separate console app, see also UI code at http://xps2img.sf.net.)

I'd suggest to reduce method as follows or even inline it.

bitmap.Render(page.Visual);

                // Memory leak fix.
                // http://social.msdn.microsoft.com/Forums/en/wpf/thread/c6511918-17f6-42be-ac4c-459eeac676fd
                ((FixedPage)page.Visual).UpdateLayout();

                _conversionStarted = true;

                return bitmap;
peters commented 10 years ago

@i2van Submit a PR the way you think it should be and i'll merge it it :)

i2van commented 10 years ago

I'm too lazy to contribute )))

peters commented 10 years ago

0.1.4 available on nuget.org

would you consider changing the license to MIT?

i2van commented 10 years ago

Is double licensing OK?

What's wrong with LGPL?

On Wed, Oct 16, 2013 at 6:18 PM, Peter Rekdal notifications@github.comwrote:

0.1.4 available on nuget.org

would you consider changing the license to MIT?

— Reply to this email directly or view it on GitHubhttps://github.com/peters/xps2img/issues/2#issuecomment-26427452 .

i2van commented 10 years ago

https://sourceforge.net/projects/xps2img/

Added MIT License.

License GNU Library or Lesser General Public License version 3.0 (LGPLv3), MIT License

On Wed, Oct 16, 2013 at 10:49 PM, Ivan Ivon ivan.ivon@gmail.com wrote:

Is double licensing OK?

What's wrong with LGPL?

On Wed, Oct 16, 2013 at 6:18 PM, Peter Rekdal notifications@github.comwrote:

0.1.4 available on nuget.org

would you consider changing the license to MIT?

— Reply to this email directly or view it on GitHubhttps://github.com/peters/xps2img/issues/2#issuecomment-26427452 .

peters commented 10 years ago

Great :)