IMGKit convert HTML to PNG of a specific part of HTML

I was not able to find this in the docs, so I ask here.

Is it possible to tell IMGKit to convert a specific part of HTML? I just want a PNG of a specific container.

So, if my HTML markup looks like this:

<html>
<head><title>Test</title></head>
<body>
<div class='container'>
Test
</div>
</body>
</html>

Just take a screenshot from the div container?

+4
source share
1 answer

I can present several options here:

  • You can create a new view that contains only the item that you want to convert to an image. If you want to avoid duplication of code, you can even make this new view into the existing one as partial.

  • GitHub IMGKit HTML , . , , :

:

kit.stylesheets << '/path/to/css/file'    
kit.javascripts << '/path/to/js/file'
0

Source: https://habr.com/ru/post/1531232/


All Articles