RelaxedJS / ReLaXed

Create PDF documents using web technologies
ISC License
11.81k stars 428 forks source link

Daemon service #86

Closed theaj closed 6 years ago

theaj commented 6 years ago

Is it possible to daemonize RelaxedJS to continuously pass in files and spit out files? I feel like there is overhead is spawning a new nodejs process for each file that we have. Keep in mind I want to run this inside a docker image, orchestrated by Kubernetes.

Thank you.

DanielRuf commented 6 years ago

Isn't pm2/nodemon sufficient for this?

https://github.com/Unitech/pm2

Zulko commented 6 years ago

@TheAJ There is an important overhead due to the fact that a new Chrome instance has to be launched each time. Therefore using the command-line ReLaXed to build PDFs on a server is not recommended.

While there may be a way to "serve" PDFs with ReLaXed in the future, right now most of the code focuses on user experience when using ReLaXed interactively, instead of on a server, mostly because the "server" case is already covered by other tools.

Could you share what your usecase is, and could it be solved by using directly pupetteer or for instance Pdf-Bot ?

theaj commented 6 years ago

@Zulko Thanks for the quick reply. Possible pdf-bot could work.

I have about 5.5 million HTML pages, which are pre-rendered and want to convert them to PDF as fast as possible. The HTML is still re-usable, so something that works with chrome was necessary.

Zulko commented 6 years ago

In that case ReLaXed is not the right tool, pdf-bot or a simple webserver using puppeteer would do (in the puppeteer README they show you how to make a PDF in 10 lines of JS).

Closing this for now.