rposborne / wkhtmltopdf-heroku

wkhtmltopdf binary for heroku / amd64
MIT License
225 stars 92 forks source link

wkhtmltopdf 0.13 #22

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hey, I really appreciate what you did with the complied version you created for heroku and it works great. Do you think it will be possible to create one for the new 0.13 alpha version? It would help me a lot as I really want use the new webkit filters, which according to my tests are only supported in the new version.

Thanks, Alon

pallymore commented 9 years ago

I will make a 0.13 branch :)

ghost commented 9 years ago

Thanks alot!

pallymore commented 9 years ago

Hello, could you try this in your gem file?

gem 'wkhtmltopdf-heroku', github: 'rposborne/wkhtmltopdf-heroku', branch: '2-12-3-0alpha'
ghost commented 9 years ago

Yeah I'll try it and let you know. I saw that you wrote in commit messgae: "upgrade wkhtmltopdf version to 0.12.3.0". You meant 0.13, right?

pallymore commented 9 years ago

Yes...my bad. I need more coffee :) try this:

gem 'wkhtmltopdf-heroku', github: 'rposborne/wkhtmltopdf-heroku', branch: ' 2-13-0-alpha'
ghost commented 9 years ago

I tried it and I got this error: "Error: QXcbConnection: Could not connect to display" I didn't get this error when I used your 0.12.2.1 file. I'm using node js on heroku. By the way, was I suppose to upload anything else to heroku except for the wkhtmltopdf-linux-amd64 file?

ghost commented 9 years ago

I read a little bit about "Error: QXcbConnection: Could not connect to display" and the recommended solution was to add xvfb to my heroku buildpack. I did so and I stop getting this error and the pdf was generated. Unfortunately the webkit filters I desired were not applied although when I ran my app locally on a Windows env with the new 0.13 alpha version it worked perfectly. Do you have any ideas?

pallymore commented 9 years ago

hmm i'm not sure what may have caused that error - i'd prefer not to change the build-pack to make this work. I'll look into it later today.

About the filter issue - there is nothing i can do, could you report that in https://github.com/wkhtmltopdf/wkhtmltopdf ?

Thanks,

ghost commented 9 years ago

I'm sorry, it was my bad. It was created without filters because I still used the old wkhtmltopdf version. I still have to find a way to configure xvfb to my buildpack. Right now I can't seem to have a multi buildpack working.

ghost commented 9 years ago

By the way, Did you tried your complied file in heroku?

pallymore commented 9 years ago

no i haven't yet...will post update as soon as i get to it :(

pallymore commented 9 years ago

hey i just updated the branch with a custom build binary - could you try it?

i was able to generate a pdf file without extra libs in my VM (similar to heroku cedar-14 stack)

thanks.

ghost commented 9 years ago

Hey, I just tried and I stopped getting those annoying errors I got before.Unfortunately those webkit-filters I want to apply that work in the Windows version doesn't seem to work. I guess I should address it to wkhtmltopdf people. Anyway, I really appreciate all your help.

pallymore commented 9 years ago

ok :) so that's most likely a wkhtmltopdf issue.

ghost commented 9 years ago

Hey, I've installed Ubuntu on my computer and downloaded wkhtmltox-0.13.0-alpha-7b36694_linux-trusty-amd64 from the wkhtmltopdf website. When I tried to convert an html with css3 webkit filters everything worked fine. My conclusion is that the fact that your file didn't work for me on Heroku isn't a wkhtmltopdf issue but something else. I see now that it's supported both on windows and on linux with the new 0.13 alpha version. Unfortunately, when I uploaded to Heroku the extracted content of the setup file I've downloaded I got the next error when I tried to use it: "Error: QXcbConnection: Could not connect to display". Are you familiar with this kind of error? Can you please guide in building an Heroku wkhtmltopdf exec from the setup I've downloaded? Thanks!

pallymore commented 9 years ago

Could you post a piece of your HTML/CSS file here? Have you tried the binary included in this branch?

to build from source, you can find the instructions here: https://github.com/wkhtmltopdf/wkhtmltopdf/blob/master/INSTALL.md

ghost commented 9 years ago

My html is very simple. You just have to replace the name of the image. What do you mean by "Have you tried the binary included in this branch"? I've used the your file: wkhtmltopdf-linux-amd64 located at https://github.com/rposborne/wkhtmltopdf-heroku/tree/2-13-0-alpha/bin. Is there anything else I should use?

https://jsfiddle.net/0qhe9ey7/

lynndylanhurley commented 8 years ago

@pallymore - I installed from this branch, but it looks like the version is still 0.12.3.

screen shot 2016-06-06 at 2 08 27 pm

It's also rendering my content as if it's still version 0.12.3. Can you verify that this branch is using the correct version?

pallymore commented 8 years ago

hello @lynndylanhurley

yea you are right, for some reason it's still 0.12.3 :/ my bad. I just updated it to 0.13.0-alpha, could you clear your bundler cache and try again? (at 2-13-0-alpha@9bbb8ad)

Thanks, P

image

lynndylanhurley commented 8 years ago

Thanks for the quick response @pallymore!

I'm getting a fatal error:

Command Error: QXcbConnection: Could not connect to display
screen shot 2016-06-06 at 3 10 41 pm

It's also complaining about "unpatched QT" for some of the options. Any ideas?

pallymore commented 8 years ago

Unfortunately wkhtmltopdf 0.13 alpha is not headless, it needs a running x11 server to render the pages. you will need to run it under xvfb

eg.

$ xvfb-run ./wkhtmltopdf test.html test.pdf

it's probably not gonna work with this gem right now, and it's definitely not recommended to be used in production.

kayakyakr commented 7 years ago

I just went through this process a year later, wanted to make a note for anyone trying it:

Used heroku-buildpack-apt w/ xvfb and the alpha deb from wkthmltopdf.org and then this guy's buildpack: https://github.com/captain401/heroku-buildpack-xvfb which is necessary to rewrite xvfb into something that can use the right paths.

It worked, yay!