Commit Graph

4 Commits (master)

Author SHA1 Message Date
James M. Greene e8380e42d7 Added CoffeeScript examples where missing, minor other fixes
Added CoffeeScript examples where missing, minor other fixes such as spacing standardization (2 spaces is the standard in CoffeeScript via Ruby). Also a small set of minor JS example fixes and additional comments.

Fixes http://code.google.com/p/phantomjs/issues/detail?id=907
2012-12-06 14:29:37 -06:00
Brikou CARRE 1125b86e72 Fixed missing exit code when errornous.
http://code.google.com/p/phantomjs/issues/detail?id=544
2012-05-17 23:35:02 -07:00
Milian Wolff b3d74c9a6c Extend printheaderfooter.js example documentation
The comment now explains how to delegate the header/footer setup
to the loaded HTML page by giving an explicit HTML example that
defines the required PhantomJSPrinting object

ISSUE: 512 (http://code.google.com/p/phantomjs/issues/detail?id=512)
2012-04-30 16:52:28 +07:00
Milian Wolff 24a9665c4d Make it possible to print pages with user-defined headers/footers.
Usage:

page.paperSize = {
  margin: "1cm",
  header: {
    height: "1cm",
    contents: phantom.callback(function(pageNum, numPages) {
      return "<h1>" + pageNum + " / " + numPages + "</h1>";
    })
  },
  footer: {
    height: "0.5cm",
    contents: phantom.callback(function(pageNum, numPages) {
      return "<h2>" + pageNum + " / " + numPages + "</h1>";
    })
  }
};

Note: The contents can return arbitrary HTML but since we cannot
re-layout the whole website for every page, the header/footers
must have the static height defined in the height property.

Note: The new example printheaderfooter.js shows the usage. It
also shows how one could delegate the above to a JavaScript
function on the loaded website, which allows one to print pages
and let the actually printed page decide how the header/footer
should look like.

Note: The page-counter can be reset by adding the class "phantomjs_reset_pagination"
to HTML block-elements that should reset the counter.

ISSUE: 410 (http://code.google.com/p/phantomjs/issues/detail?id=410)
2012-04-14 22:04:34 -07:00