FAQ Database Discussion Community


Rails 4 wicked_pdf generate blank pdf while generating from model

ruby-on-rails-4,wicked-pdf
I'm trying to save pdf on server using rails model buts its generate a blank pdf. Earlier did it in controller without problem but now its creating a blank one. Any idea What's i did wrong? def generate_bulk_pdf view = ActionView::Base.new(ActionController::Base.view_paths, {}) view.extend(ApplicationHelper) view.extend(AbstractController::Rendering) view.extend(Rails.application.routes.url_helpers) students = Student.all.order('id ASC') students.each...

Wicked-PDF not showing images, 'wicked_pdf_image_tag' undefined

ruby,ruby-on-rails-4,wicked-pdf
I want to generate a PDF with our department logo in it. When I try to use the WickedPdf class in my controller (using the method described at https://github.com/mileszs/wicked_pdf): def some_action image_tag_string = image_tag('logo.jpg') pdf = WickedPdf.new.pdf_from_string(image_tag_string) save_path = Rails.root.join('testpdfs','logotest.pdf') File.open(save_path, 'wb') do |file| file << pdf end end ...the...

Prevent OSX Download Notification When Testing PDF Download

ruby-on-rails,rspec,wkhtmltopdf,wicked-pdf
We're using wicked_pdf to render a PDF in our Rails app. I'm trying to write tests for it. controller: def index format.pdf render pdf: "index.pdf", template: "foos/index" end controller spec: it "should render a pdf" do get :index, format: :pdf end feature spec: scenario "User clicks PDF link" do click_link...

Generating and sending PDF in ActionMailer with WickedPDF

ruby-on-rails,pdf,wicked-pdf
i am using rails 4.2 and am generating pdfs in actionmailer with following code: attachments["abc.pdf"] = WickedPdf.new.pdf_from_string( render_to_string(template: "pdf_templates/abc.html", header: { content: render_to_string(layout: "header.html") }, margin: { top: 50, left: 50 }) ) mail to: @user.email, subject: "bla blubb" Its working fine and rendering the abc.html.erb. but it ignores margin-tags...

footers html content is not getting printed in wicked_pdf + rails

ruby-on-rails,ruby-on-rails-4,pdf-generation,wkhtmltopdf,wicked-pdf
I am using wicked_pdf to generate pdf for my rails application. I am trying to render a dynamic html content at the footer of my generated pdf. I have implemented following code in controller: #app/controllers/receipts_controller.rb def generate_receipt html = render_to_string(:action => 'print_receipt', :layout => false) pdf = WickedPdf.new.pdf_from_string(html, :encoding =>...

how validation is done using wicked?

ruby-on-rails,ruby-on-rails-3,wicked-pdf
I have a users_controller and a user_steps_controller which has three steps :business, :payment and :login In the user.rb model class User < ActiveRecord::Base validates_presence_of :fname, :lname, :email, :mob, :country, :state, :suburb, :postal ,:add end while checking validation if i put some random values then also it is giving errors Fname...

Rails 3 email a wicked pdf issue

ruby-on-rails,pdf,wicked-pdf
I have gem 'wicked_pdf' and gem 'combine_pdf' in a Rails 3.2 app. It works great if I'm displaying the pdf in browser. I would like to email the pdf. My current code sends the email, but the pdf is just garbage: This is the controller code: def pdfemail @costprojects =...

Heroku and wicked-pdf — libwkhtmltox.so.0 No such file

ruby-on-rails,heroku,wkhtmltopdf,wicked-pdf
I have installed wicked_pdf locally to my Rails app and it is generating pdfs. When I push it to Heroku and try to generate a pdf, I get: Command Error: /app/bin/wkhtmltopdf: error while loading shared libraries: libwkhtmltox.so.0: cannot open shared object file: no such file or directory I am running...