From 74f97b949a4d9276dde87a6120707339cc75e70c Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:04:38 -0500 Subject: [PATCH 01/13] Add initial .travis.yml. --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..c9339219 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +addons: + apt: + packages: + - google-chrome-beta + +language: node_js +node_js: + - "4.5" + - "6" + - "7" \ No newline at end of file From 11a6a9d0a372e1ca0a5ab235ee43a827685128dd Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:07:23 -0500 Subject: [PATCH 02/13] Specify chrome addon differently. --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c9339219..5d0dd5af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,5 @@ addons: - apt: - packages: - - google-chrome-beta + - chrome: beta language: node_js node_js: From 8e1750dfdd93ccc35f71671a978dd9003bbde524 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:12:26 -0500 Subject: [PATCH 03/13] Try requiring sudo. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5d0dd5af..79056b0e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,5 @@ +sudo: required +dist: trusty addons: - chrome: beta From baefdc3c0557ee80b5b6887bba387b326a8b0e6d Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:19:41 -0500 Subject: [PATCH 04/13] Add .vscode/launch.json. --- .vscode/launch.json | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..ab57eeaf --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible Node.js debug attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceRoot}/src/index.ts", + "outFiles": ["${workspaceRoot}/lib/**/*.js"], + "smartStep": true + }, + { + "type": "node", + "request": "attach", + "name": "Attach to Port", + "address": "localhost", + "port": 5858, + "outFiles": [] + } + ] +} \ No newline at end of file From c0b5cbe5d463e585a3c54f29d10886b4ee525d6d Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:20:03 -0500 Subject: [PATCH 05/13] Drop unneded lines. --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79056b0e..5d0dd5af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,3 @@ -sudo: required -dist: trusty addons: - chrome: beta From b150f796342ad95c0f3bf4171a8ed93ee0ad1401 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:22:58 -0500 Subject: [PATCH 06/13] Add if guards around chrome kill. --- lib/src/index.js | 8 ++++++-- lib/src/index.js.map | 2 +- src/index.ts | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/src/index.js b/lib/src/index.js index ffe8a29f..058a7501 100644 --- a/lib/src/index.js +++ b/lib/src/index.js @@ -39,10 +39,14 @@ function create(html, options) { reject(err); }); }).then((createResult) => __awaiter(this, void 0, void 0, function* () { - yield chrome.kill(); + if (chrome) { + yield chrome.kill(); + } return createResult; })).catch((err) => __awaiter(this, void 0, void 0, function* () { - yield chrome.kill(); + if (chrome) { + yield chrome.kill(); + } return Promise.reject(err); })); }); diff --git a/lib/src/index.js.map b/lib/src/index.js.map index 6c8363fd..a83fd312 100644 --- a/lib/src/index.js.map +++ b/lib/src/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["src/index.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CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,CAAC,MAAM,CAAC;IAChB,CAAC;IAEY,MAAM,CAAC,QAAgB;;YAClC,MAAM,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1D,CAAC;KAAA;CAEF;AAtCD,oCAsCC","file":"index.js","sourcesContent":["'use strict';\n\nimport * as CDP from 'chrome-remote-interface';\nimport * as fs from 'fs';\nimport { ChromeLauncher } from 'lighthouse/lighthouse-cli/chrome-launcher';\nimport { getRandomPort } from 'lighthouse/lighthouse-cli/random-port';\nimport { Readable, Stream } from 'stream';\n\nexport interface Options {\n port?: number;\n}\n\nexport async function create(html: string, options?: Options): Promise {\n const myOptions = Object.assign({}, options);\n myOptions.port = myOptions.port || await getRandomPort();\n const chrome = await launchChrome(myOptions.port);\n return new Promise((resolve, reject) => {\n CDP(myOptions, async (client) => {\n try {\n const {Page} = client;\n await Page.enable(); // Enable Page events\n await Page.navigate({url: `data:text/html,${html}`});\n await Page.loadEventFired();\n // https://chromedevtools.github.io/debugger-protocol-viewer/tot/Page/#method-printToPDF\n const pdf = await Page.printToPDF();\n return resolve(new CreateResult(pdf.data));\n } catch (err) {\n reject(err);\n } finally {\n client.close();\n }\n }).on('error', (err) => {\n reject(err);\n });\n }).then(async (createResult) => {\n await chrome.kill();\n return createResult;\n }).catch(async (err) => {\n await chrome.kill();\n return Promise.reject(err);\n });\n}\n\nasync function launchChrome(port: number) {\n const launcher = new ChromeLauncher({\n port,\n autoSelectChrome: true,\n additionalFlags: [\n '--disable-gpu',\n '--headless',\n ],\n });\n try {\n await launcher.run();\n return launcher;\n } catch (err) {\n await launcher.kill();\n }\n}\n\nexport class CreateResult {\n\n private static async writeFile(filename: string, data: Buffer) {\n return new Promise((resolve, reject) => {\n fs.writeFile(filename, data, (err) => {\n err ? reject(err) : resolve();\n });\n });\n }\n\n /**\n * Base64-encoded PDF data.\n */\n private data: string;\n\n public constructor(data: string) {\n this.data = data;\n }\n\n public toBase64(): string {\n return this.data;\n }\n\n public toBuffer(): Buffer {\n return Buffer.from(this.data, 'base64');\n }\n\n public toStream(): Stream {\n const stream = new Readable();\n stream.push(this.data);\n stream.push(null);\n return stream;\n }\n\n public async toFile(filename: string): Promise {\n await CreateResult.writeFile(filename, this.toBuffer());\n }\n\n}\n"],"sourceRoot":"../.."} \ No newline at end of file +{"version":3,"sources":["src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,+CAA+C;AAC/C,yBAAyB;AACzB,+EAA2E;AAC3E,uEAAsE;AACtE,mCAA0C;AAM1C,gBAA6B,IAAY,EAAE,OAAiB;;QAC1D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAC7C,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,KAAI,MAAM,2BAAa,EAAE,CAAA,CAAC;QACzD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM,CAAC,IAAI,OAAO,CAAe,CAAC,OAAO,EAAE,MAAM;YAC/C,GAAG,CAAC,SAAS,EAAE,CAAO,MAAM;gBAC1B,IAAI,CAAC;oBACH,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,CAAC;oBACtB,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,qBAAqB;oBAC1C,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAC,GAAG,EAAE,kBAAkB,IAAI,EAAE,EAAC,CAAC,CAAC;oBACrD,MAAM,IAAI,CAAC,cAAc,E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AAC,CAAC,CAAC;YACb,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CAAA;AAED;IAEU,MAAM,CAAO,SAAS,CAAC,QAAgB,EAAE,IAAY;;YAC3D,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM;gBACjC,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG;oBAC/B,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,OAAO,EAAE,CAAC;gBAChC,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;KAAA;IAOD,YAAmB,IAAY;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,QAAQ;QACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAEM,QAAQ;QACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,CAAC,MAAM,CAAC;IAChB,CAAC;IAEY,MAAM,CAAC,QAAgB;;YAClC,MAAM,YAAY,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC1D,CAAC;KAAA;CAEF;AAtCD,oCAsCC","file":"index.js","sourcesContent":["'use strict';\n\nimport * as CDP from 'chrome-remote-interface';\nimport * as fs from 'fs';\nimport { ChromeLauncher } from 'lighthouse/lighthouse-cli/chrome-launcher';\nimport { getRandomPort } from 'lighthouse/lighthouse-cli/random-port';\nimport { Readable, Stream } from 'stream';\n\nexport interface Options {\n port?: number;\n}\n\nexport async function create(html: string, options?: Options): Promise {\n const myOptions = Object.assign({}, options);\n myOptions.port = myOptions.port || await getRandomPort();\n const chrome = await launchChrome(myOptions.port);\n return new Promise((resolve, reject) => {\n CDP(myOptions, async (client) => {\n try {\n const {Page} = client;\n await Page.enable(); // Enable Page events\n await Page.navigate({url: `data:text/html,${html}`});\n await Page.loadEventFired();\n // https://chromedevtools.github.io/debugger-protocol-viewer/tot/Page/#method-printToPDF\n const pdf = await Page.printToPDF();\n return resolve(new CreateResult(pdf.data));\n } catch (err) {\n reject(err);\n } finally {\n client.close();\n }\n }).on('error', (err) => {\n reject(err);\n });\n }).then(async (createResult) => {\n if (chrome) {\n await chrome.kill();\n }\n return createResult;\n }).catch(async (err) => {\n if (chrome) {\n await chrome.kill();\n }\n return Promise.reject(err);\n });\n}\n\nasync function launchChrome(port: number) {\n const launcher = new ChromeLauncher({\n port,\n autoSelectChrome: true,\n additionalFlags: [\n '--disable-gpu',\n '--headless',\n ],\n });\n try {\n await launcher.run();\n return launcher;\n } catch (err) {\n await launcher.kill();\n }\n}\n\nexport class CreateResult {\n\n private static async writeFile(filename: string, data: Buffer) {\n return new Promise((resolve, reject) => {\n fs.writeFile(filename, data, (err) => {\n err ? reject(err) : resolve();\n });\n });\n }\n\n /**\n * Base64-encoded PDF data.\n */\n private data: string;\n\n public constructor(data: string) {\n this.data = data;\n }\n\n public toBase64(): string {\n return this.data;\n }\n\n public toBuffer(): Buffer {\n return Buffer.from(this.data, 'base64');\n }\n\n public toStream(): Stream {\n const stream = new Readable();\n stream.push(this.data);\n stream.push(null);\n return stream;\n }\n\n public async toFile(filename: string): Promise {\n await CreateResult.writeFile(filename, this.toBuffer());\n }\n\n}\n"],"sourceRoot":"../.."} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index e294661b..f29b5c91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,10 +33,14 @@ export async function create(html: string, options?: Options): Promise { - await chrome.kill(); + if (chrome) { + await chrome.kill(); + } return createResult; }).catch(async (err) => { - await chrome.kill(); + if (chrome) { + await chrome.kill(); + } return Promise.reject(err); }); } From a8aeafb7d8071f1ee37831456249e3f4c0121bc5 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:36:37 -0500 Subject: [PATCH 07/13] Try a different addon approach. --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5d0dd5af..b9201f64 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,10 @@ +dist: trusty +sudo: false + addons: - - chrome: beta + apt: + packages: + - google-chrome-stable language: node_js node_js: From 4defdea88d20fe91978917d32bcb85aebe4b9632 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:38:34 -0500 Subject: [PATCH 08/13] Switch to beta chrome. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b9201f64..b8d0c1d9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: false addons: apt: packages: - - google-chrome-stable + - google-chrome-beta language: node_js node_js: From 76438e4e165c34e1ad659ef870d4391574dcfc75 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:45:55 -0500 Subject: [PATCH 09/13] Don't support Node 4.5. --- .travis.yml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8d0c1d9..be3c06fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,5 @@ addons: language: node_js node_js: - - "4.5" - "6" - "7" \ No newline at end of file diff --git a/package.json b/package.json index d0d03919..bf49707f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "MIT", "typings": "lib/src/index.d.ts", "engines": { - "node": ">= 4.5.0" + "node": ">= 6" }, "os": [ "darwin", From 7fa5aa23eec79b29481100743ad41fa8d70050b3 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:51:11 -0500 Subject: [PATCH 10/13] Add OS X build. --- .travis.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.travis.yml b/.travis.yml index be3c06fd..2035c7ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +os: + - linux + - osx dist: trusty sudo: false @@ -5,6 +8,12 @@ addons: apt: packages: - google-chrome-beta +before_install: + - | + if [ "$TRAVIS_OS_NAME" = "osx" ]; then + brew update > /dev/null + brew cask install google-chrome-beta + fi language: node_js node_js: From 98d3bb83526869f6bdaca22478492cdeed9a86cc Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Sun, 7 May 2017 23:56:30 -0500 Subject: [PATCH 11/13] Add alt Cask repo. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2035c7ce..61637853 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ addons: before_install: - | if [ "$TRAVIS_OS_NAME" = "osx" ]; then + brew tap caskroom/versions brew update > /dev/null brew cask install google-chrome-beta fi From 399ada30d79883204b5b9f33f4f0f35f243e9895 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Mon, 8 May 2017 00:01:31 -0500 Subject: [PATCH 12/13] Silence output. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 61637853..b17bc02a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ addons: before_install: - | if [ "$TRAVIS_OS_NAME" = "osx" ]; then - brew tap caskroom/versions + brew tap caskroom/versions > /dev/null brew update > /dev/null brew cask install google-chrome-beta fi From b560cedf414dd28c8f7622f1bcfd4d61205c1506 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Mon, 8 May 2017 00:09:39 -0500 Subject: [PATCH 13/13] Add Travis CI badge. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 851f1a2a..9b81411c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # html-pdf-chrome + +[![Travis CI](https://travis-ci.org/westy92/html-pdf-chrome.svg)](https://travis-ci.org/westy92/html-pdf-chrome/) + HTML to PDF converter via Chrome/Chromium