0

Is there a way to convert an input html stream to an "image-only" pdf (not .jpg or .tif) directly using webkit based tools like wkhtmltopdf or phantom.js ?

I have tried both of wkhtmltopdf and phantom.js and the output pdf produced by either one is searchable (i.e has text that can be be searched). So, basically I would like to have the source text based HTML tags to converted to images well.

While, I can do some post-processing on output "searchable" pdf to make it "image-only" pdf, I would like to avoid it if possible..

I am open to exploring other tools as well , provided they are standards based like webkit and support media-type css.

This conversion is happening server-side, so performance and resource utilization is also a key factor.

BTW, my dev environment is dotnet / c#.

Thanks, AGore

AGore
  • 1
  • 1
    Sure, render the page as png and then convert that png to pdf. – Artjom B. Aug 28 '15 at 17:47
  • Tried that route as well, When I use wkhtmltoimage or phantom.js to convert the source html to png, the media-type css are ignored and I get the screen grab (which I don't want). I want the print grab ... Basically, "--print-media-type" option is ignored when converting to .png. Any ideas? – AGore Aug 28 '15 at 18:16
  • 1
    http://stackoverflow.com/questions/18675606/perform-screen-scape-of-webbrowser-control-in-thread – Eser Aug 28 '15 at 18:23
  • I am a bit lost with the link you sent, I do not want the screen grab... – AGore Aug 28 '15 at 18:41
  • @AGore That code loads the web page and saves it as image. All you have to do now is converting it to pdf. – Eser Aug 28 '15 at 18:44
  • @Eser Thanks for the reply. I am not sure how I can apply print media type in webcontrol. Please refer to a similar question posted here [link] (http://stackoverflow.link/how-to-set-webbrowser-media-type-to-print-in-c/). The solution presented in that post is not going to work in my situation. If you have a code sample to achieve that, please post it. – AGore Aug 28 '15 at 22:50
  • Possible duplicate of [Generating PDFs using Phantom JS on .NET applications](http://stackoverflow.com/questions/19646375/generating-pdfs-using-phantom-js-on-net-applications) – Paul Sweatte May 11 '17 at 17:12

0 Answers0