danielboendergaard / phantom-pdf Goto Github PK
View Code? Open in Web Editor NEWA Package for generating PDF files using PhantomJS
License: MIT License
A Package for generating PDF files using PhantomJS
License: MIT License
I was able to download about day before yesterday but now this shows this error.
Please help me out!
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 !
I get the following error messsage:
[BadMethodCallException]
Call to undefined method [package]
due the handling of packages was changed for 5.x laravel/framework@3a0afc2
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?
The master branch is not working with Laravel 5.2, because of 2 main issues:
symfony/http-foundation
and symfony/process
packagesurl()
function without any parameter is an instance of Illuminate\Routing\UrlGenerator::class
, and the PdfGenerator class will failCheck my modifications. I did basic tests on OSX, and it worked.
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 !
Some documentation on how configuration / options work would be useful.
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?
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?
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 !
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.
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.
The file "route\to\my\project\app\storage\html-538ccbcb8811c9.76309489.pdf" does not exist
please help me!!
When I set the base_url in my config file it does not appear to create a base tag in the view or have any effect on the document.
There is an issue with phantomjs prior to 2.0.0 with web fonts not being rendered correctly. More about the issue: ariya/phantomjs#10592
Please could you upgrade the attached phantomjs version to 2.0.0:
https://github.com/bprodoehl/phantomjs/releases/tag/v2.0.0-20150528
Thanks
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?
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
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.
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.
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 :)
In laravel 5.4 on windows the pdf generates but not until the maximum execution set timeout is reached. Why does that happen and how do i rectify it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.