3

I am looking for a way to do this within a ruby on rails app. Need to do this locally within my service as the data is sensitive, I cant use external web services to do this.

Most important is images of various types as this is what most people scan documents into.

Joelio
  • 4,621
  • 6
  • 44
  • 80
  • Found this http://www.artofsolving.com/opensource/jodconverter not sure how good it is but might be worth a try – Joelio Dec 30 '10 at 18:19

3 Answers3

3

Install LibreOffice and Unoconv in your server and run the command.

unoconv -f pdf File.doc

If you want to perform it with only LibreOffice use,

./soffice --headless --convert-to pdf destination_path source_file_path/*.doc

Preethi Kumar
  • 1,371
  • 1
  • 9
  • 16
2

Have you looked at Prawn?

EDIT

There doesn't appear to be a single solution to this problem. There are related StackOverflow questions, though, that might be of some help. For instance:

Community
  • 1
  • 1
Brian Clapper
  • 25,705
  • 7
  • 65
  • 65
  • Yes, Prawn is a pdf generation tool, afaik it doesnt convert document types. For images I think there is a way I could use prawn, but I figured there would be something better suited for this. – Joelio Dec 30 '10 at 13:48
  • Thanks, I saw those, neither seem to be what I want. I want to go to a pdf for the 2nd. And for the excel, I dont have control over those. My general use case is I have multiple document types to be merged into one big pdf. pdftk has been good at merging multiple pdfs, but havent found a solution to include additional doc types. – Joelio Dec 30 '10 at 18:14
  • ok it looks like imagemagick will convert various image types to pdf, so thats great, I only need to figure out word and excel if possible. Seems like I need to use either open office or microsoft stuff to do that. – Joelio Dec 30 '10 at 18:17
1

There now is a single solution to the problem. I work on the PDF Converter Services, so consider me biased, but I have recently written a blog post about how to convert common file types such as DOC, XLS, PPT, HTML etc to PDF (and many other file types) using Ruby. For details see this post.

Jeroen Ritmeijer
  • 2,772
  • 3
  • 24
  • 31