1

Are there methods in using rails to convert document files into image in order to display them as jpg or png. Perhaps there is a gem that can handle this

jack
  • 454
  • 2
  • 8
  • 22
  • 2
    Can you be more specific about "document files"? A Word document is vastly different from a PDF file or a QuarkExpress document. – tadman Nov 10 '11 at 17:01

1 Answers1

2

Here are some common ones:

PS: you can convert PDFs to JPG to using RMagick :)

Edit: Converting MS Office Documents to images can be done using OpenOffice - here are two solutions:

openoffice.org2.4 -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF sample.ppt

and then you can convert the PDF to an image.

Community
  • 1
  • 1
sled
  • 14,525
  • 3
  • 42
  • 70
  • where can i go to find how to modify .doc and .odt – Kevin Nov 10 '11 at 17:24
  • maybe theres a way to convert those to .pdf in rails? – Kevin Nov 10 '11 at 17:28
  • JODConverter (See second answer) -- is an excellent solution. (but im not sure how would you implement the line 'openoffice.org2.4 -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF sample.ppt' in a rails app, maybe i should just learn about CUPS-PDF) you got an up one from me – Kevin Nov 10 '11 at 18:41
  • you can spawn a child process - call openoffice on command line an print the document to a pdf file. you should do this in a background job by the way (google for "rails resque github" - its a nice tool for backgroundjobs). I'd go for the JODConverter instead of the command line solution. – sled Nov 10 '11 at 19:32