wkhtmltopdf

return pdf response from stdout with Django

谁都会走 提交于 2019-12-05 18:26:59
I am using wkhtmltopdf to create PDF files, how ever I don't know how to return them properly, so I had to write them to my media folder and then redirect to the just created file. Edit: Ian's advice is to write to STDOUT, so I have changed my wkhtmltopdf command to do that, but now I don't know how to return that content. I have been trying using subprocess.Popen this way: r = HttpResponse(Popen(command_args), mimetype='application/pdf') r['Content-Disposition'] = 'filename=recibos.pdf' return r But I am not getting good results Thanks in advance. You should open your sub command like so:

C# html to pdf converter using wkhtmltopdf or any other free tools [closed]

ⅰ亾dé卋堺 提交于 2019-12-05 17:50:19
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . What is the perfect tool for converting html to pdf in C# ?? I have found wkhtmltopdf through stackoverflow.com . But its not working . showing this message in time of converting "www.google.com" in command line. C:\Program Files\wkhtmltopdf>wkhtmltoimage.exe www.google.com go.pdf Loading page (1/2) Rendering (2/2) Error: Could not save image Done I have also downloaded EO.pdf , but not sure how to use it

Issue running 32-bit executable on 64-bit Windows

╄→尐↘猪︶ㄣ 提交于 2019-12-05 16:34:25
I'll add 500 of my own rep as a bounty when SO lets me. I'm using wkhtmltopdf to convert HTML web pages to PDFs. This works perfectly on my 32-bit dev server [unfortunately, I can't ship my machine :-p ]. However, when I deploy to the web application's 64-bit server the following errors are displayed: (running from cmd.exe) C:\>wkhtmltopdf http://www.google.com google.pdf Loading pages (1/5) QFontEngine::loadEngine: GetTextMetrics failed () ] 10% QFontEngineWin: GetTextMetrics failed () QFontEngineWin: GetTextMetrics failed () QFontEngine::loadEngine: GetTextMetrics failed () QFontEngineWin:

Wicked pdf not rendering header/footer

爷,独闯天下 提交于 2019-12-05 10:33:40
I am using wicked_pdf for generating pdf from html on my rails project. It is rendering template but I could not manage to print header/footer sections. Below is my code that print only template section render pdf: "pdf_name", layout: 'application', template: 'reports/show', formats: [:html], margin: { top: 10, bottom: 10, left: 10, right: 10 }, disable_javascript: true, show_as_html: params[:debug], header: { html: { template: 'shared/header' }, spacing: 10 }, footer: { html: { template: 'shared/footer' }, spacing: 30, line: true } If I try to use WickedPdf.new.pdf_from_string render_to

WickedPDF missing layout

南笙酒味 提交于 2019-12-05 09:38:09
I have a controller like this: def show @professor = Professor.find(params[:id]) respond_to do |format| format.html format.pdf do render :pdf => "file_name" end end end And a simple view like this: <p>Professor: <%= @professor.first_name %></p> <p>Email: <%= @professor.email if @professor.email %></p> I also have a layout 'application.html.erb'; <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title><%= content_for?(:title) ? yield(:title) : "Myapp" %><

wkhtmltopdf relative paths in HTML with redirected in/out streams won't work

做~自己de王妃 提交于 2019-12-05 08:06:20
I am using wkhtmltopdf.exe (version 0.12.0 final) to generate pdf files from html files, I do this with .NET C# My problem is getting javascript, stylesheets and images to work by only specifying relative paths in the html. Right now I have it working if I use absolute paths. But it doesn't work with relative paths, which makes the whole html generation a bit to complicated. I have boiled what I do down to the following example: string CMDPATH = @"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"; string HTML = string.Format( "<div><img src=\"{0}\" /></div><div><img src=\"{1}\" /></div><div>{2

How to create PDF in ASP.NET

假装没事ソ 提交于 2019-12-05 02:42:35
问题 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

FreeBSD wkhtmltopdf 安装

爱⌒轻易说出口 提交于 2019-12-05 02:40:57
FreeBSD 下安装wkhtmltopdf摘要: # cd /usr/ports/converters/wkhtmltopdf/ # make install clean ##### 经过漫长的等待。。。。。安装成功。咦PHP怎么提示找不到 libpng.so.6 ? wkhtmltopdf 需要libpng-1.5.1支持。 重新编译 php 安装即可。 安装完成后: /usr/local/bin/wkhtmltopdf /usr/local/bin/wkhtmltoimage 两个命令可用。 wkhtmltopdf www.baidu.com b.pdf 等等,pdf 中文方块了。 FreeBSD上缺少中文字体,拷贝一个中文字体进去就可以了。 mkdir /usr/local/lib/X11/fonts/chinese 把中文字体文件拷入chinese目录 保持权限 --r--r--r 。 可以安装webfonts字体: cd /usr/ports/X11-fonts/webfonts make install clean 刷新字体: fc-cache -f -v 来源: oschina 链接: https://my.oschina.net/u/170216/blog/138140

wkhtmltopdf page-break-after have whitespace

我是研究僧i 提交于 2019-12-05 02:30:59
问题 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

How to deal with ContentNotFoundError when using wkhtmltopdf?

梦想与她 提交于 2019-12-05 01:41:42
Can someone tell me how to resolve following issues? wkhtmltopdf don't have option to pass proxy info (-p or --proxy) unlike in previous versions and its not using system $http_proxy and $https_proxy env variable too. wkhtmltopdf not working with HTTPS/SSL even though i set LD_LIBRARY_PATH for libssl.so and libcrypto.so [deploy@localhost ~]$ wkhtmltopdf https://www.google.co.in google.pdf loaded the Generic plugin Loading page (1/2) Error: Failed loading page https://www.google.co.in (sometimes it will work just to ignore this error with --load-error-handling ignore) Exit with code 1 due to