0

I have a testing setup where I drive PhantomJS through Selenium. Now I'd like to save screen captures as PDF files instead of getting them as plain PNG.

PhantomJS could do this out of the box by calling render on the current webpage instance.

However, how can I get that instance in code that is executed in PhantomJS with a JavaScriptExecutor? Is that even possible?

Lucero
  • 59,176
  • 9
  • 122
  • 152
  • Your best option is probably to convert the PNG to a PDF. – Florent B. Aug 11 '16 at 17:30
  • @FlorentB. When rendering as PDF, it outputs in vector format, which can be scaled nicely... I want to extract a vector image from the PDF and then use the result for inclusion in automated print-quality technical documentation. – Lucero Aug 11 '16 at 17:45
  • I was able to generate the PDF with the solution provided by MTuner. Note that I had to remove some quotes to make it work. – Florent B. Aug 11 '16 at 18:40

0 Answers0