Git Product home page Git Product logo

phantom-pdf's People

Contributors

danielboendergaard avatar mactwister avatar matthijs110 avatar milhouse1337 avatar przemekperon avatar rumeau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

phantom-pdf's Issues

Request : CLI's Timeout in config

Hi there !

I wonder if you could add in the config file the timeout value (see PdfGenerator.php:93) ?

I'm using your package to generate reports which have several pages, and the default value isn't enough.

Have a nice day !

Process timing out but equivalent phantomjs command works fine

I've got phantom-pdf on a website that's been working mostly fine for some time but after our last deployment PDFs have stopped generating. We're getting this error:

1/1 in vendor/symfony/process/Process.php:1152 "The process "/path_to_application/vendor/bin/phantomjs /path_to_application/resources/assets/pdfConverter.js /path_to_application/storage/pdf-57a1daa85e7bd4.22475353.html /path_to_application/storage/html-57a1daa85e7c83.29019197.pdf" exceeded the timeout of 10 seconds."

Strangely enough, running the exact same command that the error shows on the command line works, suggesting maybe that the problem isn't with phantomJS itself? Note that when I try to generate the PDF through the web application the temporary HTML file is created but a PDF file is not (so phantomJS doesn't get that far).

Do you have any suggestions of where I could start looking to debug this?

Laravel 5.2

The master branch is not working with Laravel 5.2, because of 2 main issues:

  • Laravel 5.2 use 3.0.* version for symfony/http-foundation and symfony/process packages
  • the url() function without any parameter is an instance of Illuminate\Routing\UrlGenerator::class, and the PdfGenerator class will fail

Check my modifications. I did basic tests on OSX, and it worked.

Can't render JS in PDF with HTTPS

Hi,

first, thanks for the package. it did come pretty hand !

However, I've stumbled into some problem while trying to generate PDF on a HTTPS-only laravel site.
The view I was attempting to convert contained external js scripts (included as protocol agnostic) : jQuery, D3,... While the PDF was generated as requested, the SVG charts that should have been there did not appear.
After a bit of playing, what solved my problem was to add an option on the PhantomJS CLI : --ignore-ssl-errors=yes. Maybe because I use a self-generate certificate ?

Anyway, as I really don't like to mess around with what's under the vendor folder, it seems to me that making a config file defining which protocol is in use (HTTP vs. HTTPS), thus using the option or not in the CLI, would be ideal.

Anyway, once again, thanks !

CSS not loading over https

I have a laravel 5 site that was running in http but since they turned it to Https the css is not loading. The view produced is ok as i can see but the pdf does not have any styling (probably the css is not loaded). I see some previous issues that were solved. Where do i add the --ignore-ssl-errors=true setting?

Images are not displayed in the pdf

I am using this package for one of my project and it is working great. The only thing, that the image is not visible on the pdf file generated. Is that not the feature of this package or need to add something else for this?

Can you please help me with this?

ignore-ssl-errors doesn't work ?

Hi,

I've had some problems with loading assets (css / js) on PDF generation on a staging server. (Note that this might be related to / a duplicate of #4, but i'm not certain).

The staging server uses auto-signed certificate for HTTPS. However, setting ignore-ssl-errors to true didn't work this time (it indeed worked in the past on other Laravel 4 projects...).

After investigation, i've finally made a breakthrough after reading this thread : ariya/phantomjs#12181

When turning the debug on in the phantomJS CLI call, the output contained the "SSL handshake failed" errors. Adding the protocol option (eg. --ssl-protocol=tlsv1) in the CLI solved my issue (for the time being).

Although it doesn't seem to fix the problem in the long run, and doesn't work for everyone, it might be useful to expose more CLI options in the config file (at least debug and ssl-protocol, i'd say).

Thanks !

Windows & phantomjs 2.0 issue

I noticed an issue when using this package with Windows and phantomjs 2.0.

The command it generates is:

C:\phantomjs\bin\phantomjs.exe generate-pdf.js C:\xampp\htdocs\project\storage\pdf-55e22f9a732416.83117326.html C:\xampp\htdocs\project\storage\html-55e22f9a732638.09310424.pdf

But it fails to open the source file. I managed to fix it by prefixing the source path with file:/// like so:

C:\phantomjs\bin\phantomjs.exe generate-pdf.js file:///C:\xampp\htdocs\project\storage\pdf-55e22f9a732416.83117326.html C:\xampp\htdocs\project\storage\html-55e22f9a732638.09310424.pdf

It seems that a well-formatted URL is expected as a first argument. Do you think you could include that change in the package? I can also submit a pull request.

PDFGenerator Runtime Issue

Hi
I receive this error after finish setup the package. I wanna try to view one web view in pdf, but I receive

RuntimeException in PdfGenerator.php line 132:
PhantomJS: 'C:\xampp\htdocs\eiqa\vendor\danielboendergaard\phantom-pdf\src\config/../../bin/phantomjs' is not recognized as an internal or external command,
operable program or batch file.

Please help here.

Unable to find generate-pdf.js when running this in Homestead(vagrant)

I recently installed your package and when testing out how to use it, I wrote a quick view and unit test and when I execute the test in Homestead, I get this error:

`
Symfony\Component\Process\Exception\RuntimeException: PhantomJS: sh: 1: generate-pdf.js: not found

/home/vagrant/project/vendor/danielboendergaard/phantom-pdf/src/PdfGenerator.php:140
/home/vagrant/project/vendor/danielboendergaard/phantom-pdf/src/PdfGenerator.php:82
/home/vagrant/project/tests/PdfTest.php:18
`

My test is this:

`
namespace PdfTest.php;

use PhantomPdf\PdfGenerator;
use View;

class PdfTest.php extends \TestCase
{
function testGeneratePdf()
{
$view = View::make('pdf.test');

    $pdf = new PdfGenerator();
    $pdf->setStoragePath('/tmp');

    $pdf->saveFromView($view, '/tmp/document.pdf');
}

}
`

If i set the binary path to my Homebrew version of phantomjs and run the unit test locally, that works fine.

Thoughts?

Assets and CSS missing

Hi.

I have an issue where the pdf generated on a production server disregards any styling or assets, however this doesn't happen locally.

Locally I am running Ubuntu 14.04 LTS on a Vagrant box and same for the live server.

Any ideas?

Many thanks in advance.

Jon

Hyperlinks do not render as expected

Hello, I'm running into an issue where rendering a Laravel view into a PDF works fine, except for hyperlinks. Here's my blade code:

<h3><a href="http://www.google.com">Google</a></h3>

And I will attach a screenshot.

screen shot 2016-08-02 at 15 53 47

I get the text of the link underlined but unclickable, followed by the url which is clickable.

The desired result is a normal web hyperlink where the text of the link is clickable and the url is not visible.

I did some searching online and in the documentation, but couldn't find an answer.

add a js file path option to the config

Hi,

I've had the case recently where I needed to hack the generate-pdf.js script. However, when the package will be updated, thoses hacks will be, as intended by composer, lost.
As such, I'd love to have an option in the config file where one could indicate his own js script for phantomjs.

What are your thoughts on this ?

Kind regards :)

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.