wkhtmltopdf

python使用pdfkit生成pdf【python】

旧街凉风 提交于 2019-12-12 16:48:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.安装pdfkit pip3 install pdfkit 代码: html = '<html><head><meta charset="UTF-8"></head>' \ '<body><div align="center"><p>%s</p></div></body></html>' % text pdfkit.from_string(html, './result.pdf') 或者 pdfkit.from_file(1.html, './result.pdf') 2.测试运行 运行python3 test.py后报错 If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf 缺少:wkhtmltopdf 进行安装 yum install wkhtmltopdf github地址: https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

php shell exec hangs when using wkhtmltopdf

寵の児 提交于 2019-12-12 12:12:10
问题 I am trying to generate a PDF from HTML using PHP. I am running Mac OS X as my development environment although I would like this code to run on a production linux server. So far I have got: $url = escapeshellarg("http://www.google.com/"); $output = shell_exec("/usr/local/Cellar/wkhtmltopdf/0.11.0_rc1/bin/wkhtmltopdf " . $url . " /tmp/tmp_pdf.pdf 2>&1"); echo "<pre>$output</pre>"; This code does generate the PDF in the /tmp/tmp_pdf.pdf. The problem is it never does echo "<pre>$output</pre>";

Rotativa and wkhtmltopdf no CSS or images on iis6 over HTTPS, but fine on HTTP

我是研究僧i 提交于 2019-12-12 10:05:42
问题 Using Rotativa, a .net wrapper for wkhtmltopdf. I can not get CSS or Images to render in a PDF if I connect Via HTTPS. I have previously set this up on 2008r2 iis7 server with HTTPS(SSL) I did have simular trouble with css & webfonts, but I just changed all the paths to absolute paths and it worked. This job is deployed on ii6 windows 2003 server. Yesterday it was just producing "An unhandled exception has occurred." when ussing HTTPS so I upgraded wkhtmltopdf to V 0.12.0, now the PDF will

Is there any wkhtmltopdf option to convert html text rather than file?

只愿长相守 提交于 2019-12-12 08:31:28
问题 I recently stumbled on wkhtmltopdf and have found it to be an excellent tool for on-the-fly conversion from html to pdf in the browser. A typical usage (in Windows) would go: wkhtmltopdf.exe --some-option "<div>Some html <b>formatted</b> text</div>" www.host.com/page_to_print.html file.pdf My question is: Is there an option to use <html><head></head><body><h1>This is a header</h1></body></html> in place of www.host.com/page_to_print.html ? Thanks for any help. 回答1: Yes and no. There is no

Executing Wkhtmltopdf via php throws error

折月煮酒 提交于 2019-12-12 06:51:46
问题 I use the class mentioned in the link How do I get WKHTMLTOPDF to execute via PHP? to convert html to pdf using wkhtmltopdf via PHP. require_once('WkHtmlToPdf.php'); $link = "https://www.google.co.in"; $pdf = new WkHtmlToPdf; $options = array( 'no-outline', // option without argument 'encoding' => 'UTF-8', // option with argument 'binPath' => '/usr/bin/wkhtmltopdf', // absolute actual file path ); $pdf->setOptions($options); $pdf->addPage($link); $pdf->send(); if (!$pdf->send('test.pdf')) {

wkhtmltopdf not rendering percentage widths correctly

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:52:59
问题 I am using wkhtmltopdf to generate PDFs from bootstrap layouts, for the most part, the results are very close to what is rendered by the browser. However, I noticed that using segmented "bootstrap rows" (composed by many col-xs) makes so the total width does not add up to 100%. I am using 12 col-xs-1 in one part of the document, and the result can be seen here: Here is the CSS for the class of the columns (or at least the part I tried to change): .col-xs-1 { float: left; width: 8.333333%; } I

Jekyll : Generating file with PDFKit in a gitlab-ci pipeline

送分小仙女□ 提交于 2019-12-12 03:39:37
问题 I'm trying to generate a static website with jekyll, including the generation of a per article pdf file. Here is my jekyll module : require 'pdfkit' module Jekyll Jekyll::Hooks.register :site, :post_write do |post| post.posts.docs.each do |post| filename = post.site.dest + post.id + ".pdf" dirname = File.dirname(filename) Dir.mkdir(dirname) unless File.exists?(dirname) kit = PDFKit.new(post.content, :page_size => 'Letter') kit.stylesheets << './css/bootstrap.min.css' kit.to_file(filename) end

What is the correct way to do the CSS to avoid page breaks?

三世轮回 提交于 2019-12-12 03:37:26
问题 I’m trying to use wkhtmltopdf to turn this page into a (somewhat) nice-looking PDF document: http://z2codes.franklinlegal.net/franklin/DocViewer.jsp?showset=lubbockset&z2collection=lubbock&docid=405#405 I’m using the following code so far: a[name^="0"] p, a[name^="1"] p, a[name^="2"] p, a[name^="3"] p, a[name^="4"] p, a[name^="5"] p, a[name^="6"] p, a[name^="7"] p, a[name^="8"] p, a[name^="9"] p { display: block; page-break-inside: avoid; } a[name^="0"], a[name^="1"], a[name^="2"], a[name^="3

Odoo Qweb generated pdf report shows overlapping of the address and table rows of 2nd page

折月煮酒 提交于 2019-12-12 03:24:20
问题 When generating an invoice there is overlapping where the customer address should be and in cases where the invoice is more than one page, the table header and rows write over each other. Using the latest Odoo system and have already updated the WKHTMLTOPDF library to the latest stable release, 0.12.2.1 回答1: This is the correct Solution for overlapping between table row and table header in multi page PDF Adding the following in the CSS fixes thead { display: table-header-group } tfoot {

How generate a pdf file with django-wkhtmltopdf on IIS 7.5 - 8

断了今生、忘了曾经 提交于 2019-12-12 02:49:28
问题 I use django-wkhtmltopdf to generate pdfs in my webapp, Works fine using the django integrate server, but when I use IIS 7.5 or 8 gives me this error: WindowsError [Error 6] The handle is invalid Environment: Request Method: GET Request URL: http://127.0.0.1:8006/blabla/pdf/10/ Django Version: 1.8.5 Python Version: 2.7.10 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib