apilayer / html2pdf.it

Webservice for generating pdfs from html
html2pdf.it
549 stars 157 forks source link

Filesize: Difference between local phantomjs and your hosted version #31

Closed toovy closed 9 years ago

toovy commented 9 years ago

Hi, when I convert a page with your site html2pdf.it it is really small as text seems to be rendered as text, I can select it afterwards with Adobe PDF selection tools. When I clone this repo and use it on my mac with phantomjs 2.0 I got a huge PDF file size. When I try to select text in a PDF viewer I can't, I guess the text is rendered as image - that would explain the huge filesize.

So the question is: which phantomjs version is your server using und where do you host? Heroku?

This might be related to https://github.com/ariya/phantomjs/issues/12685.

Thanks, BR, toovy

ebdrup commented 9 years ago

Phantom 1.9.x

On Tue, Jul 7, 2015 at 9:27 AM, toovy notifications@github.com wrote:

Hi, when I convert a page with your site html2pdf.it it is really small as text seems to be rendered as text, I can select it afterwards with Adobe PDF selection tools. When I clone this repo and use it on my mac with phantomjs 2.0 I got a huge PDF file size. When I try to select text in a PDF viewer I can't, I guess the text is rendered as image - that would explain the huge filesize. So the question is: which phantomjs version is your server using und where do you host? Heroku? This might be related to https://github.com/ariya/phantomjs/issues/12685.

Thanks, BR, toovy

Reply to this email directly or view it on GitHub: https://github.com/ebdrup/html2pdf.it/issues/31

toovy commented 9 years ago

This seems to be a MacOs Phantomjs issue, not related to versions 1.9x or 2.0 . Both versions will produce very large PDFs on my MacOs. Both versions will produce slim PDFs on Heroku. So I consider this as solved.

For those interested in upgrading to a phantomjs 2.0 on heroku:

I built a 2.0 version for Heroku using this build pack https://github.com/srbartlett/heroku-buildpack-phantomjs-2.0 . Then I deleted /bin/phantompdf and removed following lines in pdf.js:

if (process.platform !== 'darwin') {
    pdfExecutable = path.resolve(path.join('bin', pdfExecutable));
}

From then on phantomjs 2.0 is used to generate the PDFs.

BR, toovy