Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to STDIN the html? #88

Open
spawn-guy opened this issue Feb 25, 2016 · 9 comments
Open

Is it possible to STDIN the html? #88

spawn-guy opened this issue Feb 25, 2016 · 9 comments
Assignees
Milestone

Comments

@spawn-guy
Copy link

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?

@jonnnnyw
Copy link
Owner

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.

@spawn-guy
Copy link
Author

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

@jonnnnyw
Copy link
Owner

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.

@jonnnnyw jonnnnyw self-assigned this May 23, 2016
@jonnnnyw jonnnnyw added this to the Version 5.0 milestone May 23, 2016
@knvpk
Copy link

knvpk commented Dec 3, 2016

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.

@jonnnnyw
Copy link
Owner

jonnnnyw commented Dec 5, 2016

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.

@arju88nair
Copy link

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

@sudhanshu2340
Copy link

Any luck yet with the feature???
Thanks.

@MikeyBeLike
Copy link

Why not just use vanilla phantomjs & rasterize.js to do this?

I've been using it to create invoices from local html files

@dk-jessn
Copy link

dk-jessn commented Dec 13, 2018

Please give a status on this as we are now a year later... 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants