Kashiftufail
Kashiftufail

Reputation: 10885

How display image during pdf generation using wicked_pdf

i am using wicked_pdf and generating pdf of users records.image tag is not working when pdf is generate.So i use this trick and write this code in application helper.

     def pdf_image_tag(image, options = {})
       options[:src] = File.expand_path(Rails.root) + '/public' + image
       tag(:img, options)
     end

and in my view i call like this

      <%= pdf_image_tag(@image.snap.url(:thumb)) unless @image.blank? %>

This is working fine for chrome and display image perfectly but not for other browsers.

Can any one give better suggestion.

Thanks....

Upvotes: 2

Views: 1944

Answers (1)

Unixmonkey
Unixmonkey

Reputation: 18784

Use the built-in helper wicked_pdf_image_tag

<%= wicked_pdf_image_tag(@image.snap.url(:thumb)) unless @image.blank? %>

Upvotes: 1

Related Questions