Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Size to PDF #32

Closed
LucasBurg opened this issue May 7, 2015 · 6 comments
Closed

Size to PDF #32

LucasBurg opened this issue May 7, 2015 · 6 comments

Comments

@LucasBurg
Copy link

What is the maximum size to PDF ?

@marcbachmann
Copy link
Owner

What size do you mean? Page count or Paper size? I actually have no Idea. I assume you'll get memory problems before you exceed the size limit of phantomjs. I wouldn't create pages that are larger than 40pages.

It really depends on how much text & images you have on it and whether you build it on mac or linux. On mac there's a bug that renders text using vectors instead of text elements. So the performance on linux is much better.

@LucasBurg
Copy link
Author

Thanks for the feedback, It is the size of the file. really had a memory problem, most managed to solve and I'm generating more than 300 pages with text and small images. thanks for developing this project!

@senica
Copy link

senica commented Jun 13, 2015

Is there anyway to stream the process? I have a very large pdf I'm trying to generate. the html file is 111MB. I set the timeout to 10 minutes :) but it just always dies. Any way to circumvent this?

pdf.create(html, {
                format: 'Letter'
                orientation: 'portrait'
                border:
                  top: '.5in'
                  right: '.5in'
                  bottom: '.5in'
                  left: '.5in'
                type: 'pdf'
                timeout: 600000 # 10 minutes
                filename: file_pdf
              }).toFile

edit:
and I have tried with toStream but I get the error mentioned below

@senica
Copy link

senica commented Jun 13, 2015

I always end up getting this:

[Error: html-pdf: Force timeout
sails-4 (out): ]

even though I'm nowhere near 10 minutes

@senica
Copy link

senica commented Jun 13, 2015

I did a little poking around this morning and was able to get my pdf to generate by changing the follow in node_modules/html-pdf/lib/scripts/pdf_a4_portrait.js

setTimeout(function() {
    return exit('Force timeout');
}, 600000); // Changed from 120000 or two minutes

No memory issues. Server skipped happily along.

@marcbachmann
Copy link
Owner

@senica I've removed the timeout.

Is there anyway to stream the process? I have a very large pdf I'm trying to generate. the html file is 111MB. I set the timeout to 10 minutes :) but it just always dies. Any way to circumvent this?

Phantom can write the pdf only to stdout or file. html-pdf uses the latter because there were some bugs on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants