spajak / cef-pdf

cef-pdf HTML to PDF utility
MIT License
77 stars 33 forks source link

[Feature-request] Render to raster-image #30

Open ststeiger opened 5 years ago

ststeiger commented 5 years ago

Could you add a render to png feature ? So I can render HTML/SVG to png ?

I've been doing this in a C# application, but all that CefGlue doesn't work right on all platforms... One way to get the image is in the OnPaint sub of CefRenderHandler.

internal class DemoCefRenderHandler: CefRenderHandler protected override void OnPaint

Example https://github.com/ststeiger/CefGlue_NetStandard/blob/master/PdfGlue/Demo/DemoCefRenderHandler.cs

ststeiger commented 5 years ago

Implemented it myselfs. Still needs a little polishing, but the heavy-lifting is done.

https://github.com/ststeiger/cef-pdf/blob/master/src/Bmp.h https://github.com/ststeiger/cef-pdf/blob/master/src/Bmp.cpp https://github.com/ststeiger/cef-pdf/blob/master/src/RenderHandler.cpp

spajak commented 5 years ago

Thanks. I will take a look and think about it