Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignored settings due to opts was not extended to ropts #85

Open
neofreko opened this issue May 22, 2015 · 1 comment
Open

Ignored settings due to opts was not extended to ropts #85

neofreko opened this issue May 22, 2015 · 1 comment

Comments

@neofreko
Copy link
Contributor

I was trying to set some config when initializing this package. But none of my setting was taken into account. I was trying to do this:

var phantom = require('phantom-render-stream')
var pr = phantom({
          format:'pdf',
          orientation: 'portrait',
          paperFormat : 'A4',
          paperSize: {
            width: '5in',
            height: '7in',
            margin: {
              top: '50px',
              left: '20px'
            }
          }
        })

Whatever value I changed there, the result didn't change at all. Apparently, these lines below basically ignore most of above values.

var initialize = function (url) {
      ropts = xtend({
        url        : url,
        quality:opts.quality,
        format     : opts.format,
        printMedia : opts.printMedia,
        expects    : opts.expects,
        timeout    : opts.timeout
      }, ropts);

Once it was changed to extend from opts, my result start transforming into what I had imagine it to be

@eastcoastcoder
Copy link

Just a heads up, some of the JSON options appear to not be applying at all. If paper related things are what you need, you'd be best off defining them within the paperSize option as an object. I had to do this to force landscape.

  var render = phantom({
      format: 'pdf',
      paperSize: {
        format: 'letter',
        orientation: 'landscape',
        margin: '0cm'
      }
  });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants