0
votes

I'm new to Ruby on rails. I work on Rails 5. I have a requirement of generating PDF document on click of a button with the details in the database, which I achieved using PRAWN gem. Now there is a requirement that On click of a button I should get an option, in which I should be able to select whether to generate a document in PDF or editable format(DOCX or any other format).

Can we achieve this with PRWAN gem in rails 5?

Please suggest me if there are any other options available.

1

1 Answers

0
votes

The gem Prawn works only the pdf.

I belive that all you need is the gem htmltoword

Usage:

require 'htmltoword'

# Configure the location of your custom templates
Htmltoword.config.custom_templates_path = 'some_path'

my_html = '<html><head></head><body><p>Hello</p></body></html>'
document = Htmltoword::Document.create(my_html, word_template_file_name)
file = Htmltoword::Document.create_and_save(my_html, file_path, word_template_file_name)