pdfgen 0.1.0 → 0.2.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 +4 -4
- data/VERSION +1 -1
- data/lib/javascript_bin/make_pdf.js +2 -1
- data/lib/pdfgen.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a11f131adef22537c617dbbebbd341b532a0073e
|
4
|
+
data.tar.gz: ba17d559c083c1295bd7bf5f6148ef498f0c1fff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ea013f074727de44cca622a744e8c9f40d563d4b5e34ae120d4820d36ef71cc401bfb7f163e08c2f458acd7f632a68d36a0cf33ed966e9c2e6ec018ed9fce43
|
7
|
+
data.tar.gz: 625a99d4b4a7f064998c655c31235dc6181de4a2dbf80c541f8d944b4d432e41ea6bfb27919cead776cbe3fd899fb551122e12c0d7eb85cc21431cee51ad2ee7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -17,6 +17,7 @@ stdin.on('end', function () {
|
|
17
17
|
var current_path = options['current_path'];
|
18
18
|
var viewport_options = options['viewport_options'];
|
19
19
|
var media_type = options['emulate_media'];
|
20
|
+
var launch_options = options['launch_options'];
|
20
21
|
|
21
22
|
module.paths.push(current_path + '/node_modules');
|
22
23
|
|
@@ -25,7 +26,7 @@ stdin.on('end', function () {
|
|
25
26
|
var html = fs.readFileSync(process.argv[2], 'utf8');
|
26
27
|
|
27
28
|
(async() => {
|
28
|
-
const browser = await puppeteer.launch();
|
29
|
+
const browser = await puppeteer.launch(launch_options);
|
29
30
|
const page = await browser.newPage();
|
30
31
|
|
31
32
|
await page.setContent(html);
|
data/lib/pdfgen.rb
CHANGED
@@ -13,6 +13,7 @@ class Pdfgen
|
|
13
13
|
@html = html
|
14
14
|
@viewport_options = nil
|
15
15
|
@emulate_media = nil
|
16
|
+
@launch_options = nil
|
16
17
|
end
|
17
18
|
|
18
19
|
def set_viewport(viewport_options)
|
@@ -25,10 +26,16 @@ class Pdfgen
|
|
25
26
|
self
|
26
27
|
end
|
27
28
|
|
29
|
+
def launch_options(launch_options)
|
30
|
+
@launch_options = launch_options
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
28
34
|
def to_pdf(opts = {})
|
29
35
|
stdin_options = { pdf_options: opts, current_path: Dir.pwd }
|
30
36
|
stdin_options = stdin_options.merge(viewport_options: @viewport_options) if @viewport_options
|
31
37
|
stdin_options = stdin_options.merge(emulate_media: @emulate_media) if @emulate_media
|
38
|
+
stdin_options = stdin_options.merge(launch_options: @launch_options) if @launch_options
|
32
39
|
file = Tempfile.new('input_html')
|
33
40
|
file.write(@html)
|
34
41
|
file.close
|