KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

PhantomJS binary executable required for PDF output #298

Open Mike Thomson opened this topic on on May 28, 2018 - 10 comments

Mike Thomson commented on May 28, 2018

I see that PhantomJS is required for the Export package. My understanding is that an application (running on windows, Linux or Mac) acting as a headless browser is used to render HTML as PDF.

This should mean that PDF export would not work on IOS or Android??? How is it that using your export demo worked on my iPhone?

Can you please clarify?

KoolReport commented on May 29, 2018

That's correct sir. It will not run on IOS and Android. If you aim at exporting PDF inside iOS or Android, you need to find another library.

Or solution could be: Our library is on your Linux web server ( or windows, mac) and your iOS or Android app will call to server by API, the server will generate PDF and return to iOS or Android. That is the only solution.

David Winterburn commented on May 29, 2018

Hi Mike,

If you access a report page that's hosted on a server that has our export package then you could export it to your mobile device. It's because phantomjs is run on that server, not on your device.

Please let us know if you need any more information. Thanks!

Mike Thomson commented on May 29, 2018

Great - thanks. That makes sense. It does probably mean any hosting will require a dedicated or virtual server.

KoolReport commented on May 30, 2018

Shared hosting works however you may need to tell support to install PhantomJS for you. Dedicated server is perfect but expensive so virtual server is the best option, less cost and you can install whatever you want. Check out DigitalOcean! We use them to host KoolReport and they seem great.

Mike Thomson commented on May 31, 2018

The core maintainer of phantomjs has announced that he'll stop supporting phantomjs in favor of an upcoming feature of chrome, see link: https://groups.google.com/forum/m/#!topic/phantomjs/9aI5d-LDuNE

This should not be a blocker yet, but it's useful to know about this.

Will there be a move to chrome headless? https://github.com/biocore/emperor/issues/580

KoolReport commented on May 31, 2018

Sure, we have had plan to add Chrome Headless to package. According to our plan, few month later you will have Export package with ability to run with both PhantomJS and Chrome Headless depending on your choice. Although PhantomJs is stopped supporting (reason is mostly because of Chrome Headless is released), it is still working very well now.

Mike Thomson commented on May 31, 2018

Good to know. I’ve got to say that the responsiveness on this forum alone makes me want to buy this product. Ideally I would like to make PDFs displayed inside a div for mobile devices. With products like TCPDF I cannot achieve this. With a headless browser approach this may be more practical. The online demo is a separate window - is PDF display inside a div (eg: a bootstrap tab) possible for mobile devices?

KoolReport commented on May 31, 2018

I've just emailed you, please check.

For your question regarding open PDF in a bootstrap tab. It is possible. I suggest you put iframe inside the tab and the src of the iframe will pointing to the export initiation file with following content:

<?php
$report = new MyReport;
$report->run()->export()->pdf()->toBrowser("myfile.pdf",true);

Notice the true parameter input to toBrowser() function, it will tell the browser to open the PDF file instead of downloading it. As a result, your iframe inside the tab will show the PDF content.

Mike Thomson commented on May 31, 2018

Thanks very much - you guys are awsome

KoolReport commented on Jun 2, 2018

Sure! If you have any difficulty with Export package, please let us know.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

Export