php-phantomjs
php-phantomjs copied to clipboard
Is it possible to STDIN the html?
I appreciate the possibility to request a certain url on the Internet.
However, I wonder if it is possible to pipe some HTML directly to the phantomJS via this php-phantomjs package?
I'm on Laravel5 and Blade. and i'd like to render some template view('some.view', $some_data)
and pipe it directly to phantomJS to render the needed PDF.
I have found some info here http://phantomjs.org/inter-process-communication.html only, I am not sure what is the proper way to implement this? via custom js template(i can try to do that) or is there already a way to achieve that?
There is an option to output the page as PDF if that is what you are after?
http://jonnnnyw.github.io/php-phantomjs/4.0/usage/#output-to-pdf
Otherwise if you could give me a more concrete example I can take a look into it.
here is an example: i generate some html with templating engine (Laravel Blade for example) into a variable in memory. and want to pipe this html with external css links directly into php-phantomjs library. $request->setHtmlContents($html)
and get PDF/Image on an output. preferably, in memory,
for now, i have to store contents into a local file and then run the phantomjs. with URL-Request ("file:///tmp/something.html") or am i missing something from the docs information?!
ps: function does not represent actual code
This doesn't really fit within the HTTP request/response API but I take a look and see if it's worth creating a separate API that can be used for local files and content streaming. Essentially it will be a separate kind of client that you can use for batch processing.
First of all thanks @jonnnnyw , Im waiting for this feature to convert the locally generated HTML content to images. Im actually planning to create images with charts (not interactive like small bar charts) on the fly and send them as push notification so that we can represent the data visually for the user.
I am currently working on this. I want to make it compatible with the changes that are happening in Version 5 so it's taking a bit longer than it normally would. Hopefully it should be released within the week.
Hi, Thank you for the work.But,I have the same issue here where I have to pass a view to the template with data. Not an external URL.Is there anyway to meet this issue?As you said,you were working on it! Has it been updated? Thank you
Any luck yet with the feature??? Thanks.
Why not just use vanilla phantomjs & rasterize.js to do this?
I've been using it to create invoices from local html files
Please give a status on this as we are now a year later... 👍