phantomjs/examples
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
..
arguments.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
arguments.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
colorwheel.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
colorwheel.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
countdown.coffee Port countdown.coffee to PhantomJS 1.2 2011-06-01 23:20:47 -07:00
countdown.js Ported 'countdown.js' to PhantomJS 1.2 2011-06-01 14:25:22 +01:00
detectsniff.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
detectsniff.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
direction.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
direction.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
echoToFile.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
echoToFile.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
features.js examples/feature.js: Show supported/unsupported features. 2011-06-26 14:05:48 -07:00
fibo.coffee Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
fibo.js Remove phantom.log, just use the de-facto console.log for logging. 2010-12-31 20:10:34 -08:00
follow.coffee Change follow.* example to Twitter accounts of PhantomJS contributors. 2012-03-04 21:49:47 -08:00
follow.js Change follow.* example to Twitter accounts of PhantomJS contributors. 2012-03-04 21:49:47 -08:00
hello.coffee Start to implement support for CoffeeScript. 2011-03-02 00:59:07 -08:00
hello.js Remove phantom.log, just use the de-facto console.log for logging. 2010-12-31 20:10:34 -08:00
imagebin.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
imagebin.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
injectme.coffee Merge pull request #155 from Roejames12/master 2011-09-14 21:45:08 -07:00
injectme.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
ipgeocode.coffee Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
ipgeocode.js Remove phantom.log, just use the de-facto console.log for logging. 2010-12-31 20:10:34 -08:00
loadspeed.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
loadspeed.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
modernizr.js examples/feature.js: Show supported/unsupported features. 2011-06-26 14:05:48 -07:00
movies.coffee Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
movies.js Remove phantom.log, just use the de-facto console.log for logging. 2010-12-31 20:10:34 -08:00
netlog.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
netlog.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
netsniff.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
netsniff.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
outputEncoding.coffee Add examples for phantom.outputEncoding 2011-08-25 03:15:26 +09:00
outputEncoding.js Add examples for phantom.outputEncoding 2011-08-25 03:15:26 +09:00
phantomwebintro.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
phantomwebintro.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
pizza.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
pizza.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
post.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
post.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
postserver.js Update more examples to use system.args. 2012-03-15 01:11:30 -07:00
printenv.js printenv.js: New example to show system.env. 2012-03-15 01:33:27 -07:00
printheaderfooter.js Make it possible to print pages with user-defined headers/footers. 2012-04-14 22:04:34 -07:00
printmargins.js Update more examples to use system.args. 2012-03-15 01:11:30 -07:00
rasterize.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
rasterize.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
render_multi_url.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
render_multi_url.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
run-jasmine.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
run-jasmine.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
run-qunit.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
run-qunit.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
scandir.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
scandir.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
seasonfood.coffee Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
seasonfood.js Remove phantom.log, just use the de-facto console.log for logging. 2010-12-31 20:10:34 -08:00
server.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
serverkeepalive.js Update more examples to use system.args. 2012-03-15 01:11:30 -07:00
simpleserver.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
simpleserver.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
sleepsort.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
sleepsort.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
technews.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
technews.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
tweets.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
tweets.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00
unrandomize.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
unrandomize.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
useragent.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
useragent.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
version.coffee Indent with 2 spaces. 2011-05-29 14:21:25 +02:00
version.js Provide an API to get PhantomJS version. 2011-01-01 08:29:03 -08:00
waitfor.coffee Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
waitfor.js Updated examples to use "require('webpage').create()" instead of "new WebPage()". 2011-09-12 21:17:54 +01:00
weather.coffee Update examples to use system.args. 2012-03-15 01:11:30 -07:00
weather.js Update examples to use system.args. 2012-03-15 01:11:30 -07:00