Code Monkey home page Code Monkey logo

Comments (10)

Abuarif avatar Abuarif commented on July 29, 2024 1

Hi,

Alhamdulillah, I got wkhtmltopdf running on ubuntu after installing wkhtmltopdf as follows:

apt-get install wkhtmltopdf
apt-get install xvfb
echo 'xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $*' > /usr/bin/wkhtmltopdf.sh
chmod a+x /usr/bin/wkhtmltopdf.sh
ln -s /usr/bin/wkhtmltopdf.sh /usr/local/bin/wkhtmltopdf
wkhtmltopdf http://www.google.com output.pdf

[reference: http://fedir.github.io/web/blog/2013/09/25/install-wkhtmltopdf-on-ubuntu/]

and configure the bootstrap with

CakePlugin::load('CakePdf', array('bootstrap' => true, 'routes' => true));
Configure::write('CakePdf', array(
'binary' => '/usr/local/bin/wkhtmltopdf', // set the correct path here
'engine' => 'CakePdf.WkHtmlToPdf',
'margin' => array(
'bottom' => 15,
'left' => 15,
'right' => 15,
'top' => 20
),
'encoding'=>'UTF-8',
'pageSize'=>'A4',
'download' => false
));

[reference: https://stackoverflow.com/questions/23978338/cakepdf-plugin-wkhtmltopdf-binary-is-not-found/25472021#25472021]

I cheat the CSS using standard html style.

--enjoy

from cakepdf.

abolkog avatar abolkog commented on July 29, 2024

I am sorry , it appears the problem was with version 0.9.9
i removed it and installed 0.11.0 rc1 and it works great
Thank you so much for this plugin 👍

from cakepdf.

egpierro avatar egpierro commented on July 29, 2024

I am having the same issue, but I do have version 0.11.0 rc1 installed: "wkhtmltopdf-0.11.0-rc1 osx".

from cakepdf.

ceeram avatar ceeram commented on July 29, 2024

incorrect encoding also could cause this problem, cakepdf uses utf8 by default.
Besides that, i cant tell why wkhtml2pdf returns no content.

from cakepdf.

egpierro avatar egpierro commented on July 29, 2024

Anything I can debug to get to the bottom of this issue?

from cakepdf.

ceeram avatar ceeram commented on July 29, 2024

CakePdf can only render if any content is being returned, its hard to tell why wkhtmltopdf is not returning any data.
You could perhaps try with very simple view and layout template, not images and external css.
also you can try wkhtmltopdf command from console, to check if it works when calling it directly.

from cakepdf.

ceeram avatar ceeram commented on July 29, 2024

You could drop by on irc #cakephp on freenode and ping me

from cakepdf.

egpierro avatar egpierro commented on July 29, 2024

I did try using the console and it works fine. I also tried a simple HTML view, nothing fancy, just text, and still cannot get past that error message. :-/

On Mar 17, 2013, at 1:32 PM, ceeram [email protected] wrote:

CakePdf can only render if any content is being returned, its hard to tell why wkhtmltopdf is not returning any data.
You could perhaps try with very simple view and layout template, not images and external css.
also you can try wkhtmltopdf command from console, to check if it works when calling it directly.


Reply to this email directly or view it on GitHub.

from cakepdf.

abolkog avatar abolkog commented on July 29, 2024

I am not sure but if the console works fine maybe the problem is with your configuration
This is my configuration , its the default one actually nothing :

CakePlugin::load('CakePdf', array('bootstrap' => true, 'routes' => true));
Configure::write('CakePdf', array(
'engine' => 'CakePdf.WkHtmlToPdf',
'margin' => array(
'bottom' => 15,
'left' => 50,
'right' => 30,
'top' => 45
),
'encoding'=>'UTF-8',
'pageSize'=>'A4',
'download' => true
));

You can also try tracing the contents, in PLUGIN_HOMe/cakePdf/Pdf/Engine/WkThmlToPdfEngine.php, when I was googling about this i saw some post about the command ($command .= " --print-media-type";) might cause the problem, but I can't find now, sorry

from cakepdf.

abolkog avatar abolkog commented on July 29, 2024

Try re-installing wkhtml , maybe it will help.
This is how i installed it (working under ubuntu server)

wget https://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2
tar -vxf wkhtmltopdf-0.11.0_rc1-static-i386.tar.bz2
mv wkhtmltopdf-i386 wkhtmltopdf
chmod a+x wkhtmltopdf
sudo mv wkhtmltopdf /usr/bin

from cakepdf.

Related Issues (20)

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.