I would like to display in my app the image of the cover page af an pdf document produced internnally within my app ( wich plugin should be better ... ? pdfwrite ?... generally it will be a less than 2 pages document) on the home page I would like to display the cover pages as png or jpg with a link to the document or another action... thanks for your suggestions erwin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
1. We''re using PDF:Writer and it should be fine with a small, 2 page document that you''re describing. 2. We''re doing exactly the sort of image conversion that you''re describing via RMagick. We''d originally installed RMagick for use with the early versions of acts_as_attachment (necessary for image uploading). It has some well-documented memory leaks, though. The code below is based on attachment_fu/acts_as_attachment but should be easily enough adapted: file_path = File.join(RAILS_ROOT, "public", @image.public_filename) img = Magick::Image::read(file_path) img[0].write File.join(RAILS_ROOT, "public", "images", "temp_pdf.jpg") (I''m off to get that last bit cleaned up... as is, each user will clobber the other :( On May 6, 2:35 pm, Erwin <yves_duf...-ee4meeAH724@public.gmane.org> wrote:> I would like to display in my app theimageof the cover page af anpdfdocumentproduced internnally within my app ( wich plugin should > be better ... ? pdfwrite ?... generally it will be a less than 2 pagesdocument) > on the home page I would like to display the cover pages as png or jpg > with a link to thedocumentor another action... > > thanks for your suggestions > > erwin--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig Demyanovich
2008-May-07 18:11 UTC
Re: how to transform a pdf document into an image.. ?
For image attachments and showing their thumbnails, Paperclip is a good alternative to attachment_fu. It doesn''t need RMagick, but it does need ImageMagick. Here''s the introductory blog post: http://giantrobots.thoughtbot.com/2008/3/18/for-attaching-files-use-paperclip Googling for rails paperclip produces lots of relevant hits. Regards, Craig --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---