Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Excel and Word files to PDF Using ruby

I want to convert Excel with multiple sheets and Word files to PDF format as a single file using Ruby.

Is there any Script/Gems/Plugins available to achieve this?

like image 645
Mani David Avatar asked Apr 29 '15 10:04

Mani David


People also ask

Why should you convert Word documents to PDF in Ruby?

While PDF files are mobile device-friendly, easy to read and can’t be altered. That’s why users convert word documents to PDF in ruby when sending important information like online bills, transactions history, and handouts etc. Now you know why you should convert Word documents to PDF file.

How to convert Office documents to PDF without MS Office license?

Sample JavaScript code for using PDFTron SDK to convert Office documents to PDF (including Word, Excel, PowerPoint and Publisher) without needing any external dependencies or MS Office licenses.

How to convert Word documents docx to PDF programmatically?

You can convert Word DOCX to PDF using the built-in functionality provided by Microsoft Office, but you may need to convert your Word documents DOCX to PDF programmatically. Using Groupdocs Conversion APIs to convert your Word documents to PDF is fast, easy and instant.


1 Answers

There is not a Gem doing all the job. but you can combine some:

  1. For excel files - read data using roo GEM - http://roo.rubyforge.org/

  2. For word files Opening .doc files in Ruby

  3. Convert the data readed in previous steps into html.

  4. Then convert it to pdf using: https://github.com/pdfkit/PDFKit

like image 67
griffon vulture Avatar answered Oct 21 '22 06:10

griffon vulture