GithubHelp home page GithubHelp logo

Comments (5)

adamreisnz avatar adamreisnz commented on June 3, 2024 2

This seems to work well, using the Chrome launcher under the hood. We now use it to launch an instance of Chrome and pass the port to this library, which then reuses this instance rather than launching one itself (and terminating it afterwards).

Would still be keen on a flag to possible keep the instance alive 👍🏼

from html-pdf-chrome.

westy92 avatar westy92 commented on June 3, 2024 1

Ah, I understand the intention, thank you for explaining more.

I think your best action would be to directly use what this library uses under the hood, chrome-launcher.

This library isn't currently designed to hold any state between runs, but I will mark this as a feature request.

from html-pdf-chrome.

westy92 avatar westy92 commented on June 3, 2024

If you pass a host and port in the CreateOptions then this library will not launch Chrome. If you omit them, it will, since there is no existing instance of Chrome for it to use. See:
https://github.com/westy92/html-pdf-chrome/blob/master/src/index.ts#L32

As recommended in the README, you can look into a solution like this to ensure Chrome runs once and stays running: https://github.com/westy92/html-pdf-chrome#usage

from html-pdf-chrome.

adamreisnz avatar adamreisnz commented on June 3, 2024

I am enquiring for a solution specifically for Heroku. As far as I'm aware, Heroku has it's own process manager to ensure that a web process keeps running and restarts after it crashes. So as far as I'm aware, it's not possible to install pm2 on it and use it to keep Chrome running.

What I am asking for, is a solution with this library. Since it is obviously capable of starting chrome instance on demand if needed, would it not be capable of starting Chrome and keep it running so that any future PDF generation calls can utilise this existing Chrome instance?

For example, if we don't specify host/port, and it launches a Chrome instance, can we pass a flag like keepAlive: true to ensure the instance will keep running? And for future calls to use this instance, if it is available?

from html-pdf-chrome.

adamreisnz avatar adamreisnz commented on June 3, 2024

from html-pdf-chrome.

Related Issues (20)

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.