Szpadel / chrome-headless-render-pdf

225 stars 67 forks source link

Adding commandline option for window size to be passed to the chrome #14

Closed gief closed 7 years ago

gief commented 7 years ago

Here is pull request for #13

This passes on window size to as a flag to the chrome binary. E.g. --window-size 1600,1200 is sent to the spawn of the chrome binary as --window=size=1600,1200

I tried to follow the same conventions in the original codebase.

Some notes:

  1. I am using the options variable to pass window size through the RenderPDF constructor.
  2. In the RenderPDF constructor, the window size option is saved as a class variable: this.commandLineOptions
  3. spawnChrome() now uses a local array (commandLineOptions) to keep track of flags

Tested with: Google Chrome 60.0.3112.90 with window size specified and no window size specified.

I hope this is helpful. Thank you

Szpadel commented 7 years ago

Thanks for PR! :+1: