Questions tagged [wicked-pdf]

Wicked PDF is a PDF generation plugin for Ruby on Rails using wkhtmltopdf to convert HTML to PDF.

Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, then let Wicked take care of the hard stuff.

(From wicked_pdf's README)

Resources

  1. Generating PDFs with wicked_pdf
579 questions
6
votes
1 answer

Rails 3, Wicked_pdf not picking up styles, print media type, or separate template

So I've been banging my head on this all day yesterday trying to get PDF rendering to work properly. After trying Prawn and PDFKit, I found that the problem with at least getting it to work at all had to do with wkhtmltopdf on Mac OS 10.7, but now…
6
votes
3 answers

Sending email with attachments

I've got a mailer that as follows: class Payments::LateNoticesMailer < AsyncMailer def notice(payment_id) @payment = PaymentDecorator.find(payment_id) @invoice = @payment.invoice template =…
5
votes
4 answers

rails, wicked-pdf gem and é à ö characters showing incorrectly

When I generate a PDF with text containing characters such as é è à and so on I do get funny characters instead. I know this must be related to encoding. I did try force_encoding("UTF-8") on the string with those characters with no success. joel
zabumba
  • 12,172
  • 16
  • 72
  • 129
5
votes
0 answers

Unable to generate pdf in production server usng wicked pdf gem

I am using wicked pdf to generate pdf. Its working fine in local server but on production mode i got into below errors: Failed to execute: ["/usr/local/bundle/bin/wkhtmltopdf", "-q", "file:////tmp/wicked_pdf20190902-26-811syo.html", …
roshita
  • 175
  • 4
5
votes
1 answer

How to generate a PDF using wicked_pdf from an API

Im creating an API that should generate a PDF based on some information on the database. When trying to call the action im getting an error: ActionController::UnknownFormat…
Fernando Maymone
  • 355
  • 2
  • 15
5
votes
2 answers

CSS and wicked_pdf not working

I'm not sure what i'm missing, but my css doesn't seem to be working along side wicked_pdf. I have an image linked in my file, which works, but the styles are missing. Gemfile gem 'wicked_pdf' gem 'wkhtmltopdf-binary' Controller format.pdf do …
DollarChills
  • 1,076
  • 1
  • 15
  • 33
5
votes
3 answers

How to return a pdf file from a rest api?

I have setup a rest API inside a ruby on rails application, I now have a requirement to generate a PDF and return this PDF from a get request. I am looking for some advice on how to implement this feature. Some of the requirements that I have are…
Andrew_tainton
  • 261
  • 1
  • 3
  • 13
5
votes
2 answers

Rails 5 render set instance variables in locals

I have some complicated PDF generation logic that requires rendering a view outside of a controller and then passing the HTML into WickedPDF: ActionView::Base.send(:define_method, :protect_against_forgery?) { false } av =…
Deekor
  • 9,144
  • 16
  • 69
  • 121
5
votes
1 answer

Wicked pdf not rendering header/footer

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:…
5
votes
2 answers

Runtime Error (Failed to execute) PDF could not be generated wicked_pdf with wkhtmltopdf-binary

I've looked high and low on stackoverflow searching for other solutions and none of them seem to have a suitable answer. So I'll try to be as specific as possible. We are using wicked_pdf (0.9.7) and wkhtmltopdf-binary (0.9.9.1) in a Ruby on Rails…
Sady
  • 412
  • 4
  • 10
5
votes
2 answers

Unable to render charts using Wicked PDF

I'm trying to render an HTML page to PDF using wicked_PDF. The page contains several charts that I create using D3.js. On the PDF, only the axes of the charts are visible. The body of the chart is blank. I tried to convert the SVG to both a Canvas…
user1742188
  • 4,563
  • 8
  • 35
  • 60
5
votes
4 answers

making a page break when pdf generated with wicked_pdf

sample.erb.html

Page 1

Page 2 So, everything after "Page 1" I want to print on the 2nd page. How can I do this? There's one solution in SO but it didn't work for me. For example, in case of Prawn, it has a nice feature called…

Askar
  • 5,784
  • 10
  • 53
  • 96
5
votes
4 answers

What is the correct way to render_to_string in wicked pdf?

This is what the documentation of wicked pdf specifies: WickedPdf.new.pdf_from_string( render_to_string(:pdf => "pdf_file.pdf", :template => 'templates/pdf.html.erb', :layout => 'pdfs/layout_pdf'), :footer => {:content =>…
user1323136
  • 889
  • 2
  • 11
  • 20
5
votes
1 answer

WickedPDF unpatched on osx

I am trying to html to pdf on mac osx. I write this command, $ wkhtmltopdf --header-center "google" http://www.google.com google.pdf but I saw the error, The switch --header-center, is not support using unpatched qt, and will be ignored.Loading…
eayurt
  • 1,169
  • 1
  • 19
  • 42
5
votes
2 answers

WickedPDF header rendering

I user mac osx and try my html file to pdf file via wickedpdf. I want to put a string every page of my pdf file but I have a problem about header which is not rendering. My wickedpdf method is, format.pdf do render :pdf =>…
eayurt
  • 1,169
  • 1
  • 19
  • 42