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
7
votes
1 answer

WickedPDF Rendering differently locally vs production

I have installed wkhtmltopdf 0.12.3 (with patched qt) on my desktop machine and the exact same version on my Centos virtual machine. I am using WickedPDF and Rails to convert HTML to PDF. When the PDF is generated it has slight differences in the…
Arthur
  • 1,970
  • 4
  • 18
  • 19
7
votes
3 answers

Bad wkhtmltopdf's path for wicked_pdf and wkhtmltopdf

I am using two Gems to convert HTML to PDF. Using "https://github.com/mileszs/wicked_pdf" gem 'wicked_pdf' gem "wkhtmltopdf-binary" /initializer/wicked_pdf.rb WickedPdf.config = { exe_path => "xxxxxxxxxxxxxxxxxxx" } What path should I use for…
KKB
  • 558
  • 4
  • 18
7
votes
2 answers

Emailing a WickedPDF in landscape orientation

I'm trying to email a .pdf in landscape format. I've been using the WickedPdf.new.pdf_from_string method to attempt to do this. Even though I specify landscape format, the emailed PDF is in portrait. If someone could show me a way to accomplish…
Quincy Larson
  • 621
  • 1
  • 6
  • 16
7
votes
1 answer

Failed to execute: Error: "\xFE" from ASCII-8BIT to UTF-8

Rails 4 *Mac OSX 10.8.4* I'm using the following Gem for wicked_pdf pdf generation: gem 'wkhtmltopdf-binary' gem 'wicked_pdf' Rendering Views as pdfs works fine and Google displays it's PDF viewer correctly. My PDFs look exactly how I want them…
sergserg
  • 21,716
  • 41
  • 129
  • 182
7
votes
1 answer

wicked_pdf is not rendering header

render :pdf => "file_name", :layout => 'pdf.html.erb', :template => 'transactions/show.pdf.erb', :wkhtmltopdf => WICKED_PDF_BIN, :show_as_html =>…
user1532866
  • 71
  • 1
  • 2
6
votes
1 answer

Custom Page Size in Wicked_PDF

Wicked_pdf docs show that I can use the following to change the page size: render :pdf => 'file_name', :page_size => "b10" However, this is limited to "named" page sizes such as "A4" or "Letter". I would like to use wkhtmltopdf's page_height and…
Lee Quarella
  • 4,662
  • 5
  • 43
  • 68
6
votes
2 answers

wicked_pdf + rails' asset pipeline + sass import in production

I'm successfully using wicked_pdf with SASS in development. I'm including a single .scss file, which contains several import rules for other .sass and .scss files, via this helper: def wicked_pdf_stylesheet_link_tag(*sources) sources.collect {…
polarblau
  • 17,649
  • 7
  • 63
  • 84
6
votes
1 answer

How to generate a pdf to save it in activestorage with wicked_pdf in rails 5?

With rails 5.2.4, I am trying to generate a pdf in the background (within a job) and then attach it to a model as: pdf_contents = ApplicationController.render( pdf: "name", template: 'mytemplate.html.erb', layout: 'pdf_layout.html', disposition:…
Gotey
  • 449
  • 4
  • 15
  • 41
6
votes
3 answers

Rails views helper don't seems to work with render_to_string

I try to convert rails views into pdf with the gem wicked_pdf. But when I do a render_to_string like this ActionController::Base.new.render_to_string(template: "templates/pdf_meteo.html.erb", locals: {communaute_meteo_id: id}, layout:…
guhurak
  • 143
  • 8
6
votes
1 answer

How to include css stylesheet into wicked pdf?

I am stuck on the gem wicked_pdf. I am generating a pdf report and I want to include stylesheets. Stylesheets are generated through webpack with tailwindcss. In wicked_pdf doc, it is said that I can use wicked_pdf_stylesheet_pack_tag and…
Thomas
  • 183
  • 1
  • 14
6
votes
1 answer

wicked-pdf hangs server when generating file

On a rails 3.2.18 application, with wicked_pdf (0.11.0) and wkhtmltopdf-binary (0.9.9.3) declared in the gem file, mime-types.rb was not amended to includeMime::Type.register "application/pdf", :pdf otherwise, on startup of Thin on osX development…
Jerome
  • 5,583
  • 3
  • 33
  • 76
6
votes
2 answers

Rails 4 wicked_pdf saving pdf on server in model

I'm trying to save pdf in model like this: def save_invoice pdf = WickedPdf.new.pdf_from_string( render_to_string(:pdf => "invoice",:template => 'documents/show.pdf.erb') ) save_path = Rails.root.join('pdfs','filename.pdf') …
Starspire
  • 272
  • 3
  • 15
6
votes
1 answer

javascript_delay throwing error in wicked_pdf

Environment:- Ruby - 1.9.3 , Rails - 4.0.0 I am generating pdf using wicked_pdf gem. For this, I used below code in my controller:- respond_to do |format| format.html format.pdf do render :pdf => 'contractors_data', …
RohitPorwal
  • 1,045
  • 15
  • 23
6
votes
1 answer

generate ZIP from generated PDFs with wicked_pdf

In my invoice system, I want a backup function to download all invoices at once in one zip file. This system is running on heroku - so it's only possible to save the pdfs temporary. I've the rubyzip and wicked_pdf gem installed. My current code in…
Adrian
  • 524
  • 5
  • 21
6
votes
3 answers

Highcharts does not work with wicked_pdf

I'm trying to generate a PDF report using the Wicked_pdf gem and Highcharts. I've already tried to set animation, enableMouseTracking and shadow false. But when wkhtmltopdf tries to generated the PDF files I got an error. I really don't not what to…
1 2
3
38 39