pdf_gem 1.0.12 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1aebe9fe7a3063f7d35e29a32bb86b7576504fa5747107b1287a094107f8e7f
4
- data.tar.gz: 5c0ac4c24612da13e73254b4bf92c106f982e494ca44e69527f293df2aa018a3
3
+ metadata.gz: 82f55cd6cf198ed27cc138949492e9c5ff5d6a5fc8303e846f8c6e424c5ed75e
4
+ data.tar.gz: c0245db08984bb5ceda9960a2543bea69c788c6c6669a0b78b7647a16d982984
5
5
  SHA512:
6
- metadata.gz: 0a24411dddd1f2d1aeb8891cd23c6cff5d8ec3c83cc6b267f79a182eb57539a2111c2142dd04f6137b7224be2642ef35aaf0f4073ba8335224cb5b0a0199b0ab
7
- data.tar.gz: 0ba4f40b1c8a38eac14c1bd99df0c72f93aed13b0410135912665f9e4de53fb56df3287b0a3a06c3523354e895841fdc566b6d7c82333c4ec0d087f513beddfb
6
+ metadata.gz: 5857ff4e1b39e6b6624555fc3c1be761a88615a5a694690b73a95e9f37e76f642d051d7de227d56977d1a84b2eade4bb0cabba9ce70578eb54cff477a8d8b686
7
+ data.tar.gz: d614d15897d2b8eb795573fe6606fdc6aeef3aea0414267316d04b28bb2728187513f27acfb8f8b7db8918e6b4436ff1a8a54d898402fb2441379ddb4e57f451
data/README.md CHANGED
@@ -69,14 +69,24 @@ PdfGem.pdf_from_string(options)
69
69
  ## Options
70
70
 
71
71
  - `options` <[Object]> Options object which might have the following properties:
72
- - `url` <[string]> (Used only for PdfGem.pdf_from_url) This is the url to render.
72
+ - `url` <[string]> (Used only for PdfGem.pdf_from_url) This is the url to render.
73
+ - `html` <[string]> (Used only for PdfGem.pdf_from_string) This is the html string to render.
73
74
  - `timeout` <[number]> Maximum navigation time in ms, default is 3000 ms.
74
75
  - `waitUntil` <[string]|[Array]<[string]>> When to consider navigation succeeded, defaults to `load`. Given an array of event strings, navigation is considered to be successful after all events have been fired. Events can be either:
75
76
  - `load` - consider navigation to be finished when the `load` event is fired.
76
77
  - `domcontentloaded` - consider navigation to be finished when the `DOMContentLoaded` event is fired.
77
78
  - `networkidle0` - consider navigation to be finished when there are no more than 0 network connections for at least `500` ms.
78
79
  - `networkidle2` - consider navigation to be finished when there are no more than 2 network connections for at least `500` ms.
79
- - `html` <[string]> (Used only for PdfGem.pdf_from_string) This is the html string to render.
80
+ - `cookies` <[Array]> set cookie in browser session
81
+ - `name` <[string]> required
82
+ - `value` <[string]> required
83
+ - `url` <[string]>
84
+ - `domain` <[string]>
85
+ - `path` <[string]>
86
+ - `expires` <[number]> Unix time in seconds.
87
+ - `httpOnly` <[boolean]>
88
+ - `secure` <[boolean]>
89
+ - `sameSite` <["Strict"|"Lax"]>
80
90
  - `disposition` <[string]> (Use only for controller render) Disposition string (inline/attachment).
81
91
  - `formats` <[string]> (Use only for controller render) Force to load view of a particular format (pdf, html, xml).
82
92
  - `filename` <[string]> (Use only for controller render) Filename of the file.
@@ -1,3 +1,3 @@
1
1
  module PdfGem
2
- VERSION = '1.0.12'
2
+ VERSION = '1.1.0'
3
3
  end
@@ -18,6 +18,11 @@ const path = require('path');
18
18
  try{
19
19
  const params = {...JSON.parse(Buffer.from(stdinBuffer.toString(), 'base64').toString('utf-8')), ...{path: filename}};
20
20
  const page = await browser.newPage();
21
+ if(params.cookies != null){
22
+ for(var i = 0; i<params.cookies.length; i++)
23
+ await page.setCookie(params.cookies[i])
24
+ }
25
+
21
26
  await page.goto(params.url, {waitUntil: (params.waitUntil != null ? params.waitUntil : 'load'), timeout: (params.timeout == null ? 30000 : params.timeout)});
22
27
  await page.pdf(params);
23
28
  process.stdout.write(filename)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdf_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Blasina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-04 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails