sungaila / PDFtoImage

A .NET library to render PDF files into images.
https://www.sungaila.de/PDFtoImage/
MIT License
187 stars 24 forks source link

Alternative 2D Libraries? #103

Open svengeance opened 2 days ago

svengeance commented 2 days ago

Hey! This library looks amazing, so thank you first off for the hard work.

I was wondering if you'd considered componentizing the rendering pipeline such that we could install separate packages for different providers? For instance, PDFToImage.Skia and PDFToImage.ImageMagick and PDFToImage.ImageSharp.

I'm selfishly asking out of curiosity for my own use-case, where I already have ImageMagick installed, and it would be cool to be able to reuse it. In this same project I was delighted to find Zxing implemented something similar: https://www.nuget.org/packages/ZXing.Net.Bindings.Magick/

Thanks for the consideration!

sungaila commented 2 days ago

Hi @svengeance,

that's a good idea! This library has switched from GDI to SkiaSharp before so a weaker coupling would be desirable.

However, there are a few reasons I don't want to implement multiple 2D graphic backends right now:

A compromise might be to split this library into PDFtoImage and PDFtoImage.Core. The latter package contains interfaces for the rendering stuff. The former package has adapters for SkiaSharp and the current API as is.

I'll take a look at this. You will have to write your own ImageMagick adapter, however, when this package is split in two.

Greetings David

svengeance commented 2 days ago

Fair game of course on implementing our own bindings. I wasn't expecting it to be nonbreaking and a fair amount of work on your end.

Personally I think it might benefit you in the long run as well, as swapping providers might provide some measurable performance or reliability gains in the future, in addition to the consumer benefits of being able to reuse existing image libraries.

Thank you for considering it!