Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How To Download Wkhtmltopdf Ubuntu

17 views
Skip to first unread message

Keiko Bludworth

unread,
Jan 7, 2024, 8:02:12 AM1/7/24
to
I was following along with Ryan Bates' really great railscast on PDFkitwhen I ran into a few problems installing wkhtmltopdf ( I also postedabout my problem in the episode comments). I was wondering if anyoneelse has experienced similar problems or has any clues as to what isgoing wrong. It is a rails 3 app, 1.9.2 running on snow leopard. I uservm



how to download wkhtmltopdf ubuntu

Download https://t.co/ThpYGOEajm






I recently had the requirement of serving a certain report from a Rails based system in pdf format. I went through some trial and error and research in several areas before I came up with what ended up working for us, which is wkhtmltopdf (Web Kit Html to Pdf). Hope this helps someone else out there.


Back to the main event now, there was the decision to use a DSL such as Prawn or to find an html to pdf converter. In the past I have been happy enough with the latter, but on first glance what was available for Rails was either not ready for prime time or costly (Prince). I recommend someone making this decision to visit John McCaffreys site and watch his screencast. In it he describes three methods of generating pdfs and the pros/cons to each. It was this resource which led me to look at wkhtmltopdf:


Since PdfKit had installed wkhtmltopdf, I decided to try a direct conversion using wkhtmltopdf directly (see below), and found that in using wkhtmltopdf directly did make the links active. From this point forward, I bypassed the Ruby gems and used wkthmltopdf directly.


The first question was how to install wkhtmltopdf on the server. Since I had not been successful installing it on my own on my Mac (I used the PdfKit ruby gem to install it), it was not clear if I would succeed here.


Thanks you so much for your reply. My development environment is snowleopard and then I deploy to a ubuntu server. To be honest I'm justtrialling stuff at moment but strangely ran into problems gettingthings working on snow leopard. I actually figured out what was goingon but I will definitely be looking at your advice when it comes todeploying to ubuntu.






I tried to install via the method mentioned by Conor above and when Igenerate a PDF, it comes up blank. I also try running from the commandline and I also get a blank PDF. It's really strange, when I installedthe first time (into the default location) and I ran from command line,I got it to work with "wkhtmltopdf www.google.com goof.pdf" but ithasn't worked since. I have a new MacBook, running rvm with ruby 1.8.7and rails 3.


Any thoughts you have would be greatly appreciated. I'm wondering if Isomehow need to do a complete delete after the various attempts atinstallation, but I don't see anything else to delete aside from thewkhtmltopdf file in use/local/bin or the rvm directory. Have either ofyou had to install the 64 bit version?


I tried to revert back to my system Ruby (out of RVM) and installingpdfkit via Gem install. Then in installed wkhtmltopdf with pdfkit asstated above. It runs from the command line, but it still creates ablank pdf. It's funny, the pdfs open but there is just no content. I'mstumped.


Ok, here's one for you. I ran "wkhtmltopdf -H www.google.comgoogle.pdf" and got a blank document but it had the header. Then Iloaded an html file that I had on my local computer and it worked....good stuff. It appears that my command line is just having troublereaching the internet. I'm a hotel this week, so perhaps it's somethingto do with the way their wireless connection is set up. Now I just haveto figure out why I'm getting an error when using PDFKIT.... thanks foryour help


For printing-related purposes, Odoo 16 requires a wkhtmltopdf version higher than 0.12.2. Wkhtmltopdf is an open-source command line tool to render HTML data into PDF format using Qt webkit. To install wkhtmltopdf on your Ubuntu 22.04 server, follow the steps below.


wkhtmltopdf and wkhtmltoimage are two open source( LGPLv3) command line tools which are used to render HTML into PDF and colourful image formats using the Qt WebKit rendering machine. These commands run entirely" headless" and don't bear a display or display service.


I wonder why SC puts all this third party software , which is not SC responsibility, wkhtmltopdf is not even used in SC i believe , pdf app type is hooked up in another pdf library.

you find a right version and plug it in.

I guess it is time SC cleans up the installation,

it is so huge , it is unbearable . also the update of the production env should be addressed,

how come there is no option to update it from the deployment center after the initial deployment

there is production environment , it is another place SC may consider to add upgrades such that a right version of the production libraries is pulled from the SC server.


I see a number other pdf libraries in prod/third such as qpdf, tcpdf

I make only custom pdf from html , therefore i use wkhtmltopdf, this requires a lot of customization

for headers, footers, TOC, quality.

but i think the standard export to pdf uses something much simpler


You might delete unused or customized third party libraries from ZIP before making an upload to your production. (such as wkhtmltopdf, otherwise SC files will overwrite your customizations).

#thirdparty #applications:prod-environment #deployment #wkhtmltopdf


by the way , I am using version 0.12.6 of wkhtmltopdf. previous versions had bugs.

you need wkhtmltopdf-amd64 for CENTOS

(centos is discontinued from 2022, you need to step over to Alamalinux. )

we run now dev and few production on #almalinux on Azure VM , works good except some #Azure limitations that are already solved.


no big deal, i was wondering if the standard export of scriptcase to pdf and pdf app are using wkhtmltopdf from the third parties lib at all. Cause if so , which functionality is using it and why they are using an old buggy version?


this command install an outdated wkhtmltopdf and odoo generate a wrong pdf (with 0 byte ) and popup error saying to update to the new wkhtmltopdf. So this is not a ODOO Error, but we can say it`s a wkhtmltopdf issue(moreover it`s a version issue).


Warning! Version in debian/ubuntu repos have reduced functionality (because it compiled without the wkhtmltopdf QT patches), such as adding outlines, headers, footers, TOC etc. To use this options you should install static binary from wkhtmltopdf site or you can use this script.


By default, PDFKit will run wkhtmltopdf with quiet option turned on, since in most cases output is not needed and can cause excessive memory usage and corrupted results. If need to get wkhtmltopdf output you should pass verbose=True to API calls:


wkhtmltopdf - the location of the wkhtmltopdf binary. By default pdfkit will attempt to locate this using which (on UNIX type systems) or where (on Windows).meta_tag_prefix - the prefix for pdfkit specific meta tags - by default this is pdfkit-Example - for when wkhtmltopdf is not on $PATH:


If you are getting strange results in PDF or some option looks like its ignored you should try to run wkhtmltopdf directly to see if it produces the same result. You can get CLI command by creating pdfkit.PDFKit class directly and then calling its command() method:


Make sure that you have wkhtmltopdf in your $PATH or set via custom configuration (see preceding section). where wkhtmltopdf in Windows or which wkhtmltopdf on Linux should return actual path to binary.


This error means that PDFKit was unable to process an input. You can try to directly run a command from error message and see what error caused failure (on some wkhtmltopdf versions this can be cause by segmentation faults)


I am using wkhtmltopdf 0.10.0 rc2 on Ubuntu (Linux 3.2.0-24-generic #38-Ubuntu x86_64 GNU/Linux). The problem I'm experiencing is that I can't create PDFs with margin-top or margin-bottom. I'm not getting any errors.


Running wkhtmltopdf and wkhtmltoimage to create PDF files from HTML files on a Mac is easy and simple. When you need to install it on a non-mac production server a little bit of work is involved.


The Problem: Installing it simply via sudo apt-get install wkhtmltopdf on Ubuntu will install a reduced functionality version which is probably not what you want. According to the manual the reduced functionality version does not include the following features.


Reduced Functionality:

This version of wkhtmltopdf has been compiled against a version of QT without

the wkhtmltopdf patches. Therefore some features are missing, if you need

these features please use the static version.


It's me again. Still to little problems:

a) How can I tell wkhtmltopdf to wait some seconds until data on a page are fully loaded?

b) How can I print special characters like in the footer? (Actually, I get - printed instead)



P.S. If you create such an "URL-Catcher", please let us know .-)


I just downloaded the latest version for Windows (wkhtmltox-0.11.0_rc1-installer.exe) and I'll check to see if the options you're looking for are in it.



[Note: the Windows install puts it in C:\Program Files (x86)\wkhtmltopdf under Windows 7. Don't use the modify path option during install with Vista or Win7, it says it will break your path. You'll have to add it manually it seems.]



There's a manual page for version 0.10.0 and a Wiki (but the Wiki seems to be geared towards developers instead of users).



Regarding the copyright symbol, I know the version I was using had difficulties with some characters. Maybe that's all been fixed in this Release Candidate.


I tried to run command C:\Program Files (x86)\wkhtmltopdf\bin\wkhtmltopdf.exe *.html *.pdf and I get the error: C:\Program is not recognized as an internal or external command...



It doesn't seem to like the spaces in the Program Files (x86) folder.


eellis mymachine:$ wkhtmltopdf -q --header-html _header_pdf.php --margin-top 20 --header-spacing 8 /tmp/464971164.html -The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --header-spacing, is not support using unpatched qt, and will be ignored.wkhtmltopdf: cannot connect to X server

35fe9a5643



0 new messages