jsreport / jsreport-phantom-pdf

jsreport recipe which is rendering pdf from html using phantomjs
GNU Lesser General Public License v3.0
11 stars 8 forks source link

Pass phantom CLI Arguments? #31

Open lemkepf opened 6 years ago

lemkepf commented 6 years ago

We have an image used in a template that is hosted on AWS Cloudfront using SNI SSL. Phantom is throwing an error downloaded that:

debug: Request https://xxxxx.com/igp2768w.jpg
warn: Unable to load resource (#2URL:https://xxxxx.com/igp2768w.jpg)
warn: Error code: 6. Description: SSL handshake failed

We'd love to be able to pass in some CLI Params to Phantom to bypass this error: '--ignore-ssl-errors=true', '--ssl-protocol=tlsv1', '--web-security=false'

I don't see any documentation on if that is even possible. Thanks for the help!

pofider commented 6 years ago

I think we already send these flags to the phantom https://github.com/pofider/phantom-html-to-pdf/blob/master/lib/dedicatedProcessStrategy.js#L18

Can you make sure that changing those args will fix your issues? I would love to make this configurable, but too busy at this moment. However will happily merge PRs if provided.

lemkepf commented 6 years ago

Yea, I modified and it still didn't work. I switched over to Chrome-PDF and it worked flawlessly first try.... so that's something I guess.

Crzech commented 4 years ago

There are news about this issue? I'm having the same problem.

sanshrestha21 commented 1 year ago

change this on file

jsreport/node_modules/phantom-html-to-pdf/lib/dedicatedProcessStrategy.js

before edit config

    var childArgs = [
        '--ignore-ssl-errors=true',
        '--web-security=false',
        '--ssl-protocol=any'
    ];

==================== after change on line --ssl-protocol from (any to tlsv1)

    var childArgs = [
        '--ignore-ssl-errors=true',
        '--web-security=false',
        '--ssl-protocol=tlsv1'
    ];

=========== restart jsreport service and it worked!! thanks @lemkepf

sanshrestha21 commented 1 year ago

no didn't work