Skip to content
This repository was archived by the owner on May 30, 2023. It is now read-only.

Issue 17: Make paper size for the PDF export specifiable #15

Merged
merged 1 commit into from
Mar 19, 2011
Merged

Issue 17: Make paper size for the PDF export specifiable #15

merged 1 commit into from
Mar 19, 2011

Conversation

aportale
Copy link
Contributor

http://code.google.com/p/phantomjs/issues/detail?id=17

Adding a new phantom property called "paperSize". It takes one of the two possible dictionary variants:
{ width: '200px', height: '300px', border: '0px' }
{ format: 'A4', orientation: 'portrait', border: '1cm' }

  • If no paperSize is defined, the size is defined by the web page
  • supported dimension units are: mm, cm, in, px. No unit means px.
  • border is optional and defaults to 0.
  • supported formats are: A3, A4, A5, Legal, Letter, Tabloid
  • orientation (portrait|landscape) is optional and defaults to portrait

I'm considering implementing a short form like:
phantom.paperSize = 'A4';
...needs further investigation.

http://code.google.com/p/phantomjs/issues/detail?id=17

Adding a new phantom property called "paperSize". It takes one of
the two possible dictionary variants:
   { width: '200px', height: '300px', border: '0px' }
   { format: 'A4', orientation: 'portrait', border: '1cm' }
- If no paperSize is defined, the size is defined by the web page
- supported dimension units are: mm, cm, in, px. No unit means px.
- border is optional and defaults to 0.
- supported formats are: A3, A4, A5, Legal, Letter, Tabloid
- orientation (portrait|landscape) is optional and defaults to portrait

I'm considering implementing a short form like:
  phantom.paperSize = 'A4';
...needs further investigation.
@ariya
Copy link
Owner

ariya commented Mar 19, 2011

I think "If no paperSize is defined, the size is defined by the web page" is a behavior change to version 1.0? If yes, I'll add some note in the ChangeLog.

@ariya ariya merged commit fbb524e into ariya:master Mar 19, 2011
@aportale
Copy link
Contributor Author

Yes, that's a change of default behaviour.
In 1.0, you got a driver-dependent (aka arbitrary) paper size: http://doc.trolltech.com/latest/qprinter.html#paperSize .
In 1.1, you get the same size (in pixels at 72 dpi) as you would get for png/jpg/gif renders.

I was hesitating changing the default. But the "driver-dependent" fact and inconsistency with the other graphics formats seemed a good argument for it. If requested, I'm willing to change the default back to 1.0 behavior, the change is trivial.

@aportale
Copy link
Contributor Author

Ariya, something went wrong with the Pull request. I was hoping to get
https://github.com/aportale/phantomjs/commit/fbb524e62975dff46734c5cccb518f89f784c05b pulled.
But instead it became
3f9596a .

@aportale
Copy link
Contributor Author

Ah, not true what I sais. I was just fooled by a merge commit.
Everything fine! :)

ariya added a commit that referenced this pull request May 28, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants