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
Asked
Active
Viewed 1,095 times
1
-
2Can 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 Answers
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:
- JODConverter (See second answer)
- Convert to PDF (using CUPS-PDF printer driver) like:
openoffice.org2.4 -norestore -nofirststartwizard -nologo -headless -pt Cups-PDF sample.ppt
and then you can convert the PDF to an image.
-
-
-
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