Code Monkey home page Code Monkey logo

html-pdf-chrome's Introduction

html-pdf-chrome

npm version Build Status Maintainability Code Coverage Known Vulnerabilities Funding Status

HTML to PDF or image (jpeg, png, webp) converter via Chrome/Chromium.

Prerequisites

Installation

npm install --save html-pdf-chrome

Security

This library is NOT meant to accept untrusted user input. Doing so may have serious security risks such as Server-Side Request Forgery (SSRF).

CORS

If you run into CORS issues, try using the --disable-web-security Chrome flag, either when you start Chrome externally, or in options.chromeFlags. This option should only be used if you fully trust the code you are executing during a print job!

Usage

Note: It is strongly recommended that you keep Chrome running side-by-side with Node.js. There is significant overhead starting up Chrome for each PDF generation which can be easily avoided.

It's suggested to use pm2 to ensure Chrome continues to run. If it crashes, it will restart automatically.

As of this writing, headless Chrome uses about 65mb of RAM while idle.

# install pm2 globally
npm install -g pm2
# start Chrome and be sure to specify a port to use in the html-pdf-chrome options.
pm2 start google-chrome \
  --interpreter none \
  -- \
  --headless \
  --disable-gpu \
  --disable-translate \
  --disable-extensions \
  --disable-background-networking \
  --safebrowsing-disable-auto-update \
  --disable-sync \
  --metrics-recording-only \
  --disable-default-apps \
  --no-first-run \
  --mute-audio \
  --hide-scrollbars \
  --remote-debugging-port=<port goes here>
# run your Node.js app.

TypeScript:

import * as htmlPdf from 'html-pdf-chrome';

const html = '<p>Hello, world!</p>';
const options: htmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
};

// async
const pdf = await htmlPdf.create(html, options);
await pdf.toFile('test.pdf');
const base64 = pdf.toBase64();
const buffer = pdf.toBuffer();
const stream = pdf.toStream();

// Promise
htmlPdf.create(html, options).then((pdf) => pdf.toFile('test.pdf'));
htmlPdf.create(html, options).then((pdf) => pdf.toBase64());
htmlPdf.create(html, options).then((pdf) => pdf.toBuffer());
htmlPdf.create(html, options).then((pdf) => pdf.toStream());

JavaScript:

const htmlPdf = require('html-pdf-chrome');

const html = '<p>Hello, world!</p>';
const options = {
  port: 9222, // port Chrome is listening on
};

htmlPdf.create(html, options).then((pdf) => pdf.toFile('test.pdf'));
htmlPdf.create(html, options).then((pdf) => pdf.toBase64());
htmlPdf.create(html, options).then((pdf) => pdf.toBuffer());
htmlPdf.create(html, options).then((pdf) => pdf.toStream());

View the full documentation in the source code.

Saving as a Screenshot

By default, pages are saved as a PDF. To save as a screenshot instead, supply screenshotOptions. All supported options can be viewed here.

const htmlPdf = require('html-pdf-chrome');

const html = '<p>Hello, world!</p>';
const options = {
  port: 9222, // port Chrome is listening on
  screenshotOptions: {
    format: 'png', // png, jpeg, or webp. Optional, defaults to png.
    // quality: 100, // Optional, quality percent (jpeg only)

    // optional, defaults to entire window
    clip: {
      x: 0,
      y: 0,
      width: 100,
      height: 200,
      scale: 1,
    },
  },
  // Optional. Options here: https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride
  deviceMetrics: {
    width: 1000,
    height: 1000,
    deviceScaleFactor: 0,
    mobile: false,
  },
};

htmlPdf.create(html, options).then((pdf) => pdf.toFile('test.png'));

Using an External Site

import * as htmlPdf from 'html-pdf-chrome';

const options: htmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
};

const url = 'https://github.com/westy92/html-pdf-chrome';
const pdf = await htmlPdf.create(url, options);

Using Markdown

import * as htmlPdf from 'html-pdf-chrome';
import * as marked from 'marked';

const options: htmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
};

const html = marked('# Hello [World](https://www.google.com/)!');
const pdf = await htmlPdf.create(html, options);

Using a Template Engine

Pug (formerly known as Jade)

import * as htmlPdf from 'html-pdf-chrome';
import * as pug from 'pug';

const template = pug.compile('p Hello, #{noun}!');
const templateData = {
  noun: 'world',
};
const options: htmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
};

const html = template(templateData);
const pdf = await htmlPdf.create(html, options);

HTTP Headers

Specify additional headers you wish to send with your request via CreateOptions.extraHTTPHeaders.

const options: HtmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
  extraHTTPHeaders: {
    'Authorization': 'Bearer 123',
    'X-Custom-Test-Header': 'This is great!',
  },
};

const pdf = await HtmlPdf.create('https://httpbin.org/headers', options);

Custom Headers and Footers

Note: Requires Chrome 65 or later.

You can optionally provide an HTML template for a custom header and/or footer.

A few classes can be used to inject printing values:

  • date - formatted print date
  • title - document title
  • url - document location
  • pageNumber - current page number
  • totalPages - total pages in the document

You can tweak the margins with the printOptions of marginTop, marginBottom, marginLeft, and marginRight.

At this time, you must inline any images using base64 encoding.

You can view how Chrome lays out the templates here.

Example

const pdf = await htmlPdf.create(html, {
  port,
  printOptions: {
    displayHeaderFooter: true,
    headerTemplate: `
      <div class="text center">
        Page <span class="pageNumber"></span> of <span class="totalPages"></span>
      </div>
    `,
    footerTemplate: '<div class="text center">Custom footer!</div>',
  },
});

Trigger Render Completion

There are a few CompletionTrigger types that wait for something to occur before triggering PDF printing.

  • Callback - waits for a callback to be called
  • Element - waits for an element to be injected into the DOM
  • Event - waits for an Event to fire
  • Timer - waits a specified amount of time
  • LifecycleEvent - waits for a Chrome page lifecycle event
  • Variable - waits for a variable to be set to true
  • Custom - extend htmlPdf.CompletionTrigger.CompletionTrigger
const options: htmlPdf.CreateOptions = {
  port: 9222, // port Chrome is listening on
  completionTrigger: new htmlPdf.CompletionTrigger.Timer(5000), // milliseconds
};

// Alternative completionTrigger options:
new htmlPdf.CompletionTrigger.Callback(
  'cbName', // optional, name of the callback to define for the browser to call when finished rendering.  Defaults to 'htmlPdfCb'.
  5000 // optional, timeout (milliseconds)
),

new htmlPdf.CompletionTrigger.Element(
  'div#myElement', // name of the DOM element to wait for
  5000 // optional, timeout (milliseconds)
),

new htmlPdf.CompletionTrigger.Event(
  'myEvent', // name of the event to listen for
  '#myElement', // optional DOM element CSS selector to listen on, defaults to body
  5000 // optional timeout (milliseconds)
),

new htmlPdf.CompletionTrigger.LifecycleEvent(
  'networkIdle', // name of the Chrome lifecycle event to listen for. Defaults to 'firstMeaningfulPaint'.
  5000 // optional timeout (milliseconds)
),

new htmlPdf.CompletionTrigger.Variable(
  'myVarName', // optional, name of the variable to wait for.  Defaults to 'htmlPdfDone'
  5000 // optional, timeout (milliseconds)
),

License

html-pdf-chrome is released under the MIT License.

html-pdf-chrome's People

Contributors

capndave avatar congelli501 avatar danielruf avatar dependabot[bot] avatar gendelflugansk avatar greenkeeper[bot] avatar halbgut avatar rgba avatar snyk-bot avatar sparlampe avatar westy92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

html-pdf-chrome's Issues

An in-range update of @types/node is breaking the build 🚨

Version 8.0.31 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.30
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/chai is breaking the build 🚨

Version 4.0.4 of @types/chai just got published.

Branch Build failing 🚨
Dependency @types/chai
Current Version 4.0.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/chai is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Help for newcomer in NodeJS

I tried to use your library but I am new to NodeJS and did not succed to reproduce the README example.

Here is what i tried on Archlinux (I would like to use it next on Windows but it seems more complicated):

  • install nodejs (v8.1.2)
  • install chromium (v59.0.3071.104)
  • install html-pdf-chrome (npm install --save html-pdf-chrome)
  • copy/paste the javascript example in README to a file test.js
  • run node test.js

I get the following error message:

(node:9689) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: connect ECONNREFUSED 127.0.0.1:9222
(node:9689) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:9689) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: connect ECONNREFUSED 127.0.0.1:9222
(node:9689) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: connect ECONNREFUSED 127.0.0.1:9222

Do I have forgotten something ?

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

An in-range update of @types/node is breaking the build 🚨

Version 8.0.25 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.24
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Similar PDFs failing

At time of writing this i am using html-pdf-chrome version 0.3.0 from npm.

I have encountered a problem when attempting to create multiple different pdfs, when creating a pdf after the first from different html that contains the same content within the <style></style> tags and different content "htmlPdf.create" will hang until manually stopped. even changing so much as the order of elements within the style will allow the that html to be rendered to pdf. So in the below example if in either html1 or html2 (not both) the order of .red and .blue are swapped the pdf will be created properly.

So far I have tried:

  • using pm2 to launch chrome as well and had the same result.
  • copying changes made by pull request #56 which also had the same result.
  • shutting down and relaunching chrome between each pdf, this works but is rather slow and an undesirable fix.

sample code that reproduces this error can be found below, you just need to call example().


import * as chromeLauncher from 'chrome-launcher';
import * as htmlPdf from 'html-pdf-chrome';
const html1 = `
<html>
    <head>
        <style>
            .red {
                color: #FF0000;
            }
            .blue {
                color: #0000FF;
            }
        </style>
    </head>

    <body>
        <p class="red">I am doc 1</p>
    </body>
</html>`;

const html2 = `
<html>
    <head>
        <style>
            .red {
                color: #FF0000;
            }
            .blue {
                color: #0000FF;
            }
        </style>
    </head>
    <body>
        <p class="blue">I am doc 2</p>
    </body>
</html>`;
const example = async() => {
    let chrome = await chromeLauncher.launch({
        chromeFlags: [
            '--disable-gpu',
            '--headless'
        ]
    });
    let options = {
        port: chrome.port
    };

    const pdf1 = await htmlPdf.create(html1, options);
    console.log('pdf1 created');
    const pdf2 = await htmlPdf.create(html2, options);
    console.log('pdf2 created');
    // using pdf(x).toFile(name); creates the expected pdf files

    await chrome.kill();
};

Is there a way to generate multiple pdfs synchronously without changing the html header and without completely restarting chrome?

Set Cookie

Is there any way of setting cookies?

Thanks!

An in-range update of @types/node is breaking the build 🚨

Version 8.0.21 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.20
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of tslint is breaking the build 🚨

Version 5.8.0 of tslint was just published.

Branch Build failing 🚨
Dependency tslint
Current Version 5.7.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

tslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v5.8.0

⚠️ Deprecations

  • [deprecation] typeof-compare is deprecated because typescript already does that check (#3286)
  • [deprecation] CLI argument --type-check is no longer necessary and will be removed in the next major version (#3322)

⚠️ Updates to tslint:latest configuration

+    "ban-comma-operator": true,
+    "jsdoc-format": {
+        options: "check-multiline-start",
+    },
+    "no-duplicate-switch-case": true,
+    "no-implicit-dependencies": true,
+    "no-return-await": true,

🎉 Features

🛠 Bugfixes & enhancements

Thanks to our contributors!

  • Klaus Meinhardt
  • Charles Samborski
  • Donald Pipowitch
  • Josh Goldberg
  • mmkal
  • Erik
  • Csaba Miklos
  • Dominik Moritz
  • Khalid Saifullah
  • Lukas Spieß
  • Merott Movahedi
  • Bowen Ni
  • ksvitkovsky
  • Hutson Betts
  • Caleb Eggensperger
  • Brent Erickson
  • Trivikram
  • Brandon Furtwangler
  • Pavel Zet
  • aervin_
  • Holger Jeromin
  • Danny Guo
  • Jeremy Morton
  • Cyril Gandon
  • Andy Hanson
  • yadan
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/chai is breaking the build 🚨

Version 4.0.3 of @types/chai just got published.

Branch Build failing 🚨
Dependency @types/chai
Current Version 4.0.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/chai is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/sinon-chai is breaking the build 🚨

Version 2.7.29 of @types/sinon-chai just got published.

Branch Build failing 🚨
Dependency @types/sinon-chai
Current Version 2.7.28
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/sinon-chai is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of chrome-remote-interface is breaking the build 🚨

Version 0.24.4 of chrome-remote-interface just got published.

Branch Build failing 🚨
Dependency chrome-remote-interface
Current Version 0.24.3
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

chrome-remote-interface is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 5 commits.

  • 41e647c Bump version
  • cc7d442 Fix tests according to the new way of using the browser target
  • fc870f2 Improve the issue template
  • 5f0f4e8 Add FAQ entry about 'Error: Promise was collected'
  • 4505c5a Add container question to issue template

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of mock-fs is breaking the build 🚨

Version 4.4.2 of mock-fs was just published.

Branch Build failing 🚨
Dependency mock-fs
Current Version 4.4.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

mock-fs is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 9 commits.

  • 8667e34 4.4.2
  • 5058b56 Log changes
  • 4af814d Merge pull request #222 from tschaub/denar90-patch
  • 1ed9d5c tiny es5 => es6
  • 72e8982 Merge pull request #221 from tschaub/mutantcornholio-throw-on-undefined
  • 3759ed6 Throw error if item content is invalid
  • 3704cc4 Merge pull request #220 from tschaub/updates
  • cfaf067 Stop caching node_modules
  • 65ffb78 Updated dev dependencies

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.32 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.31
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Pass long HTML strings to Chrome

Most likely, 'data:text/html,' + html has a length limitation. Instead of passing a string of HTML to Chrome using a data URL, use a temporary file.

An in-range update of chrome-launcher is breaking the build 🚨

Version 0.8.1 of chrome-launcher just got published.

Branch Build failing 🚨
Dependency chrome-launcher
Current Version 0.8.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

chrome-launcher is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 4 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of chai is breaking the build 🚨

Version 4.1.2 of chai just got published.

Branch Build failing 🚨
Dependency chai
Current Version 4.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As chai is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 4.1.2 / 2017-08-31

This release fixes a bug when running in certain environments, and includes a few minor documentation fixes.

Bug Fixes

  • fix: update deep-eql to version 3.0.0 (#1020)
  • fix: replace code causing breakage under strict CSP (#1032; @Alhadis)

Docs

Commits

The new version differs by 8 commits.

  • 529d395 Merge pull request #1037 from Cutlery-Drawer/master
  • b534fca [email protected]
  • c592551 Merge pull request #1032 from Cutlery-Drawer/csp-fix
  • 31c3559 Use a hardcoded no-op instead of instancing
  • 1ae9386 Merge pull request #1025 from yanca018/master
  • 786043b Update license
  • 7c1ca16 docs: add missing assert parameters (#1023)
  • 6e72c5a fix(package): update deep-eql to version 3.0.0 (#1020)

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/chai-string is breaking the build 🚨

Version 1.1.31 of @types/chai-string just got published.

Branch Build failing 🚨
Dependency @types/chai-string
Current Version 1.1.30
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/chai-string is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of mocha is breaking the build 🚨

Version 3.5.3 of mocha just got published.

Branch Build failing 🚨
Dependency mocha
Current Version 3.5.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v3.5.3

3.5.3 / 2017-09-11

🐛 Fixes

  • #3003: Fix invalid entities in xUnit reporter first appearing in v3.5.1 (@jkrems)
Commits

The new version differs by 3 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of typescript is breaking the build 🚨

Version 2.5.3 of typescript just got published.

Branch Build failing 🚨
Dependency typescript
Current Version 2.5.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As typescript is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes TypeScript 2.5.3

This release include a set of bug fixes reported against TypeScript 2.5.2. For the complete list of fixed issues, check out the fixed issues query for TypeScript 2.5.3.

Download:

Commits

The new version differs by 51 commits.

  • 94b4f8b Update LKG
  • aa40be6 Merge pull request #18673 from RyanCavanaugh/port18603
  • 6281b05 Report external files in initial case
  • 5538770 Look at correct 'package.json' location for a scoped package (#18580) (#18651)
  • acfd670 Merge pull request #18617 from amcasey/NoModifiers25
  • 9630c46 JavaScript: handle lack of modifiers on extracted method
  • 7b5247f Merge pull request #18605 from RyanCavanaugh/portExternalFilesFixes
  • 6ed9bad Port plugin fixes from master
  • e9a9d2c Merge pull request #18518 from amcasey/ExtractMethodFixes25
  • 27bede8 Stop requiring that the full range of a declaration fall within the
  • f0b7843 Merge pull request #18508 from amcasey/ExtractSingleToken
  • 063e8a7 Merge pull request #18427 from amcasey/GH17869
  • fbb6cd5 Merge pull request #18448 from amcasey/NestedReturn
  • a667b04 Merge pull request #18423 from amcasey/GH18188
  • 334125e Merge pull request #18343 from amcasey/InsertionPosition

There are 51 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.35 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.34
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of chrome-remote-interface is breaking the build 🚨

Version 0.24.5 of chrome-remote-interface just got published.

Branch Build failing 🚨
Dependency chrome-remote-interface
Current Version 0.24.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

chrome-remote-interface is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 3 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.23 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.22
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.33 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.32
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Emoji not rendered

Hi.
Thanks for this awesome package!
When i use it locally with emoji in HTML, the emoji are rendered.
But when i tried to render the same HTML to PDF on heroku the emoji are replaced by square or weird code : 🚀.

Any idea why ?

Thanks a lot.

Allow creating multiple PDFs in parallel

I receive Error: unexpected server response (500) when attempting to create multiple PDFs in parallel.

I have two questions related to this:

  1. Is this a limitation of Chrome or the html-pdf-chrome library?
  2. Is this the desired behaviour?

Example creating PDFs in parallel:

Results with Error: unexpected server response (500)

const htmlPdf = require('html-pdf-chrome');

const google = htmlPdf.create('http://google.com', { port: 9222 })
const twitter = htmlPdf.create('http://twitter.com', { port: 9222 })

google.then(pdf => pdf.toFile(__dirname + '/google.pdf'))
twitter.then(pdf => pdf.toFile(__dirname + '/twitter.pdf'))

Example creating PDFs in series:

Behaves as expected with two pdf file outputs

const htmlPdf = require('html-pdf-chrome');

htmlPdf.create('http://google.com', { port: 9222 })
  .then(pdf => {
    pdf.toFile(__dirname + '/google.pdf')

    htmlPdf.create('http://twitter.com', { port: 9222 })
      .then(pdf => {
        pdf.toFile(__dirname + '/twitter.pdf')
      })
  })

Note: I can create the PDFs in parallel if I use multiple instances of Chrome, but this is obviously not ideal.

An in-range update of typescript is breaking the build 🚨

Version 2.5.2 of typescript just got published.

Branch Build failing 🚨
Dependency typescript
Current Version 2.5.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As typescript is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes TypeScript 2.5

For release notes, check out the release announcement

For new features, check out the What's new in TypeScript 2.5.

For the complete list of fixed issues, check out the issues fixed in TypeScript 2.5 RC and after TypeScript 2.5 RC.

Download:

Special thanks to all contributors to this release:

  • Anders Hejlsberg
  • Andrew Casey
  • Andy Hanson
  • Arthur Ozga
  • Basarat Ali Syed
  • Benjamin Lichtman
  • Daniel Rosenwasser
  • Francois Wouts
  • Jan Melcher
  • Kanchalai Tanglertsampan
  • Klaus Meinhardt
  • Kārlis Gaņģis
  • Matt Mitchell
  • Mine Starks
  • Mohamed Hegazy
  • Nathan Shively-Sanders
  • Paul van Brenk
  • Ron Buckton
  • Ryan Cavanaugh
  • Sheetal Nandi
  • Tingan Ho
  • Tycho Grouwstra
  • Wesley Wigham
Commits

The new version differs by 26 commits.

  • 171c664 Update LKG
  • 20da159 Merge pull request #18127 from RyanCavanaugh/port18120_release25
  • 6425ea2 Don't crash when a JS file appears in an inferred context
  • 6ffe829 Update LKG
  • 15a0d3f Update version
  • 2a2773f Update LKG
  • 187a21c Fix crash in name resolution with custom transforms and emitDecoratorMetadata
  • 62678cd Don't try to extract import to a method: simpler fix (#18054)
  • 3644771 Test for action description of code actions, and simplify description for extracting method to file (#18030) (#18044)
  • a39ae1f Fix crash when attempting to merge an import with a local declaration (#18032) (#18034)
  • 350c9f6 Call dynamic import transform on expression used by export equal statement (#18028) (#18033)
  • 0851f69 Added additional test
  • 01b7df6 Switch to arrow for ts class wrapper IIFE
  • 9bb1915 PR feedback
  • ec8f5cf Follow symbol through commonjs require for inferred class type

There are 26 commits in total.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.29 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.28
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.19 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.18
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.44 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.43
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build is in progress Details
  • continuous-integration/appveyor/branch AppVeyor build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/mocha is breaking the build 🚨

Version 2.2.43 of @types/mocha just got published.

Branch Build failing 🚨
Dependency @types/mocha
Current Version 2.2.42
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/mocha is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/sinon is breaking the build 🚨

Version 2.3.4 of @types/sinon just got published.

Branch Build failing 🚨
Dependency @types/sinon
Current Version 2.3.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/sinon is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.46 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.45
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

ES6 code issue

I got the issue when I start my node server

...../node_modules/html-pdf-chrome/lib/src/index.js:55
                    const { Page } = client;

It seems like the component cannot be compiled by itself Any ideas to have a fix on this?

Text disappears completely

Just today I started having a weird issue with this package, where the text in my PDF is disappearing completely.

The strange thing is that it doesn't happen consistently. Sometimes the PDF will render correctly, but other times all text will be missing. I haven't made any changes to the PDF generation code for a while, so I'm fairly confident the issue is not on my end. Upon debugging, the text is clearly present in the HTML.

Example (black areas censored):

image

And other times (exact same file generated by exact same script):

image

As you can see images and borders etc. are still there, it's just the text is gone.

Any idea what could be causing this?

File size of the PDF with text is about twice the size, so there's definitely data missing.

An in-range update of @types/node is breaking the build 🚨

Version 8.0.20 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.19
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

What happened to the `toStream` option?

I used this in html-pdf to pipe a stream to the response in Express, but it seems to be gone from html-pdf-chrome. Will it make a comeback? Do you have an alternative?

Feature request (Custom headers/footers)

Is it possible to add custom header/footer?

I searched for a way to do it using the chrome executable directly but they seem to point that it will be the responsibility of third party apps/libraries to implement it...

Implement Timeout

Hi,
for my use case, i'm trying to generate a pdf report which is now in html with lots of ajax calls.
When using the library I'm getting a blank page as everything is rendered through ajax (it's an angularjs web app).

I implemented a hacky timeout option with setTimeout.
I changed the javascript directly and it's my first time touching generators so I won't post my own code.
Would be lovely if someone implemented a non-hacky solution.

An in-range update of gulp-tslint is breaking the build 🚨

Version 8.1.2 of gulp-tslint just got published.

Branch Build failing 🚨
Dependency gulp-tslint
Current Version 8.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As gulp-tslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 6 commits.

  • 53534f8 Add package-lock.json
  • c5a1bf5 Release 8.1.2
  • 9be2ca5 Merge pull request #135 from charlescook/fix-test
  • b25d3dd Fix broken tests
  • 9d802a6 Merge pull request #134 from charlescook/override
  • 3192ee0 Determine configuration separately for each source file

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.28 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.27
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

I made a server library for html-pdf-chrome

Hey,
Just wanted to say we (at Traede) really appreciate your library. It has made our life a lot better these last few days :-)! We just open sourced our pdf server that uses html-pdf-chrome to generate PDFs. Thought you might be interested in seeing it. You can find it here pdf-bot. Feedback is very welcome!

Let us now if we can help out with issues, we will try our best to help! Keep up the good work!

An in-range update of codecov is breaking the build 🚨

Version 2.3.1 of codecov was just published.

Branch Build failing 🚨
Dependency codecov
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

codecov is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 3 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of tslint is breaking the build 🚨

Version 5.6.0 of tslint just got published.

Branch Build failing 🚨
Dependency tslint
Current Version 5.5.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/appveyor/branch AppVeyor build succeeded Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v5.6.0

🎉 New rules, options, and fixers

🛠 Bugfixes & enhancements

Thanks to our contributors!

  • Klaus Meinhardt
  • Julian Verdurmen
  • Alexandre Alonso
  • Josh Goldberg
  • ksvitkovsky
  • Daisuke Yokomoto
  • Andrii Dieiev
  • Florent Suc
  • Jason Killian
  • Amin Pakseresht
  • reduckted
  • vilicvane
  • Russell Briggs
  • Andy Hanson
  • Leo Liang
  • Dan Homola
  • BehindTheMath
  • David Golightly
  • aervin
  • Daniel Kucal
  • Ika
  • Chris Barr
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.