2

I found a lot of examples on how to capture screen and export its content to PDF. By looking at all of them, looks like the best way to do this is using PhantomJS. But I haven't really found a good example on how to include that library and work with Phantom.

I have few d3 charts on my page, so is there a good example how to capture all page content? BUT only specific area of the page, I don't want to include page navigation, header..etc

Alchnemesis
  • 479
  • 8
  • 23
  • This has been covered ad nauseum, see e.g. [this tutorial](http://www.d3noob.org/2013/07/export-image-from-d3js-page-as-svg-or.html) or [this library](http://d3export.cancan.cshl.edu/) or [this article](http://nesterko.com/blog/2012/01/30/measuring-homophily-in-network-data-and-how-to-export-from-d3-js-to-pdf/) or [this question](http://stackoverflow.com/questions/16049538/how-to-convert-save-d3-svg-graph-to-pdf-jpeg) or ... – Lars Kotthoff Apr 28 '14 at 10:01
  • 2
    I know it has been asked every now and then and every answer directs it to same solutions, but none of them seems to work for me. I want whole page to get initialized as PDF, including all html and svg elements. So far, with those examples I get "failed to load given url" for image generated from svg, while inspecting the code – Alchnemesis Apr 28 '14 at 10:59
  • Could you provide an example of what you want and the failures? Also, you say in the question that you *don't* want the entire page and in your comment that you *do* want the entire page. – Lars Kotthoff Apr 28 '14 at 11:02
  • I don't want whole html, just a part of it, the main content without menu bar, header, footer...etc. In that main content I have few d3 charts that are dynamically populated with ajax requests. And want to export all "main content" into pdf. So my pdf file looks exact as viewing it from a browser. The point here is, is there some kind of script to tell "get all elements inside and create a pdf from it". Looks like phantomJS do exact that, but I can't figure it out how does it work. How do I include PhantomJS library... – Alchnemesis Apr 28 '14 at 11:11

0 Answers0