wkhtmltopdf

wkhtmltopdf 协助后端导出复杂pdf文件的第三方软件(1)

余生颓废 提交于 2019-12-04 01:19:48
1、首先,去wkhtmltopdf下载对应版本的Linux版本,地址如下: https://wkhtmltopdf.org/downloads.html 2、这里我服务器是centos 7,所以下载一个对应centos7的版本,下载得到一个rpm包。 3、接着放到服务器的某个目录底下,接着使用下面的命令: rpm -ivh wkhtmltox-0.12.5-1.centos7.x86_64.rpm 4、接着,不出意外的报错啦,竟然少了那么多依赖包: 5、缺少相关的依赖包,所以需要安装对应的依赖包(可以根据缺少的依赖包目录安装) (1)xorg-x11-fonts-75dpi依赖包: yum install xorg-x11-fonts-75dpi.noarch 遇到询问是否时,都恢复 y。 (2)xorg-x11-fonts-Type1依赖包: yum install xorg-x11-fonts-Type1.noarch 同样,遇到询问是否时,都恢复 y。 (3)libjpeg依赖包: yum install libjpeg (4)libXrender依赖包: yum install libXrender (5)libXext依赖包: yum install libXext (6)好像不用在安装其他的了,因为此时我再次执行命令: rpm -ivh wkhtmltox-0.12.5

wkhtmltopdf missing SVG paths (Rendering)

旧巷老猫 提交于 2019-12-03 23:08:45
I'm using a image inside the HMTL code like here below: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Test</title> </head> <body> <svg height="291pt" version="1.1" viewBox="0 0 291 291" width="291pt" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css">*{stroke-linecap:butt;stroke-linejoin:round;} </style> </defs> <g id="figure_1"> <g id="patch_1"> <path d="M 0 291.4 L 291.4 291.4 L 291.4 0 L 0 0 z" style="fill:none;"></path> </g> <g id="axes_1"> <g id="line2d_1"> <path clip-path="url(#p6e64365aaf)" d="M 268.427273 145.7 L

Python configure pdfkit on windows

醉酒当歌 提交于 2019-12-03 22:58:50
I started to learn python recently and I want to convert existing html file to pdf file. It is very strange, but pdfkit seems to be the only lib for pdf docs for python. import pdfkit pdfkit.from_file("C:\\Users\\user\Desktop\\table.html", "out.pdf") An error occurs: OSError: No wkhtmltopdf executable found: "b''" How to configure this lib properly on windows to make it work? I can't get it :( It looks like you need to install wkhtmltopdf. For windows, the installer can be found at https://wkhtmltopdf.org/downloads.html Also check out a post by this guy, who is having the same problem: Can't

How to create PDF in ASP.NET

与世无争的帅哥 提交于 2019-12-03 20:19:10
I have seen lot of threads on it and really no good answer anywhere. Or rather none suit my situation. We need to print Business Letter for given list with mail merge facilities. Client is not willing to spend $$ On paid ASP.NET control to make PDF. so I opt for WKHTMLtoPDF and it works fine for us until one day client try to get PDF of 100+ leads, resulting in complete failure of PDF generation. It works just fine with 10-20 page PDF, but not for 100. Is there any Tips & Trick to improve performance ? We are using Cloud hosted IIS 7 with ASP.NET 4, if that matter. marquito If you're looking

wkhtmltopdf page-break-after have whitespace

萝らか妹 提交于 2019-12-03 20:18:27
I use WKHTMLTOPDF to generate a PDF from a printer-friendly webpage. I upgraded from version 0.10.0 rc2 to 0.12.1 (with patched qt) but now when I use the CSS properties like page-break-before:always; it inserts a bunch of whitespace , and the page-breake-inside:avoid; doesn't work, it's magic. I use this call: /usr/local/bin/wkhtmltopdf --encoding 'UTF-8' 'page-to-print' '/tmp/PDFV59OZt' I have tried with and without both --print-media-type and --no-print-media-type . When I render the printer-friendly page in my browser, and when I try to print it (before I make it a pdf) it works fine.

wkhtmltopdf: Is it possible to merge PDF files?

∥☆過路亽.° 提交于 2019-12-03 17:11:04
问题 Using this library wkhtmltopdf, is it possible to merge 2 pdf files. I need to generate a report and merge the report with some attached documents. Generation of report is done, converting from HTML to PDF. But I need to merge the resulting PDF with some other PDFs 回答1: wkhtmltopdf doesn't provide support for merging PDF's. You can accomplish this using GhostScript . It's a pretty powerful tool and frequently used by Linux users. You can use the following command: gs -dBATCH -dNOPAUSE -q

letter-spacing is too large with wkhtmltopdf

柔情痞子 提交于 2019-12-03 17:04:24
I'm using wkhtmltopdf to download a webpage as pdf. But the css property letter-spacing seems doesn't work font-size:20px; letter-spacing:0px; font-size:20px; letter-spacing:1px; The spacing is very large for 1px... I tried with 2 differents font-family Its a known issue. https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1575 . No fix for it. Only to avoid using letter-spacing Issue every one face with letter spacing, perfect solution is here. import pdfkit #SnippetBucket.com code for pdfkit path_wkthmltopdf = r'/var/www/aukcnydom/wkhtmltox/bin/wkhtmltopdf' config = pdfkit.configuration

wkhtmltopdf footer-html encoding utf-8

被刻印的时光 ゝ 提交于 2019-12-03 15:48:37
问题 wkhtmltopdf --encoding utf-8 is not working for --footer-html. I am using the following command. Both HTML files are also in utf8 format. wkhtmltopdf --dpi 120 -O Portrait --encoding 'utf-8' --footer-html /tmp/testFooter.html /tmp/testMain.html /tmp/testPDF.pdf Both files have french characters. But in pdf footer have bad characters. <html> <head> <title></title> </head> <body> <div style="width:95%;font-size:9pt;font-family:Arial;"> <div style="border-top: 1px solid black;width: 100%;text

Wicked pdf rendering the last row across two pages

我的梦境 提交于 2019-12-03 15:14:30
问题 I am using wicked_pdf to generate pdfs. The problem i am facing is that, sometimes it displays the last row in the page across two pages. Is there a way to tell wicked_pdf to render the row in next page if it can't fit the entire row in that page or set a limit on the number of rows in a page? Below image is an example of my problem. My options are render :pdf => file_name, :layout => "pdf.html", :disposition => "attachment" 回答1: Since WickedPDF isn't actually creating a table (just rendering

How to remove the Table of Contents from the Table of Contents in WKHTMLTOPDF?

大憨熊 提交于 2019-12-03 14:45:12
I am generating a pdf using WKHTMLTOPDF with the table of content option, but it is adding itself to the table of contents, showing that it is on page 2. Thoughts on removing this? You have full control over the TOC generation using XSL stylesheets for their generation. You can get the default stylesheet used by giving the argument --dump-default-toc-xsl to wkhtmltopdf. When you examine it, you are particularly interested in the <body><h1>...</h1> H1 element and the test xsl:if test="(@title!='')" For example, when I want to remove the TOC self-reference from itself, this is the relevant part