I am currently developing an administrative package using Ruby on Rails 3.2.
One of the tasks that must be completed is the creation of contracts and invoices .
Since the application must host multiple clients, I want each client to be able to download some kind of template that dictates their personal style and layout. (i.e. logo, company name, addr, etc.).
I mean letting clients create their own .docx contract templates using variables and placeholders that my application should replace when a specific contract / invoice is created. Please note: people who create templates will not have technical skills .
How can i do this? Please note that owners will be placed, which can be replaced directly, as well as duplicate elements that should be contained in the tables. The number of these elements may vary from contract to contract.
After reviewing many solutions, gems, and available examples, I cannot find one that works for my situation. This is what I have tried so far:
- Docx processing by extracting document.xml and replacing placeholders. This is not very reliable and reliable because spellchecking or line breaks separate XML nodes containing placeholders.
- wicked_pdf and other html> pdf generators: are not viable since I cannot expect my clients to supply custom CSS to style them.
- Shrimp: more suitable for creating documents from scratch. The functionality of the template just does not do what I need, and does not support the replacement of placeholder data and duplicate elements.
- Google Drive: Cancel the template on Google and use the Drive API to change the document and pull out the PDF when it's done: add extra reliability to the external service. More as a last resort. Hope to find out which solution I can execute locally.
I have the feeling that I'm missing something obvious. I canβt imagine that such a mundane task, like creating a document, is so complicated when using Ruby on Rails.
source share