Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final format output for download #19

Open
JohnRDOrazio opened this issue Jun 22, 2021 · 2 comments
Open

Final format output for download #19

JohnRDOrazio opened this issue Jun 22, 2021 · 2 comments
Labels
question Further information is requested

Comments

@JohnRDOrazio
Copy link
Collaborator

Seeing @mkasberg raised the question on the Slack channel, we can discuss here how to go about producing the final format that the end user can download / print / have printed.

My vision is to be as flexible as possible, and offer as many options as possible. A first choice would be PDF, but I would leave the option (if technically feasible) for DOCX, or even InDesign / Latex.

Useful GEMS to go about doing this:

  • For InDesign and LaTeX: https://www.ruby-toolbox.com/projects/review - Re:VIEW is a digital publishing system for books and ebooks. It supports InDesign, EPUB and LaTeX
  • For PDF: Prawn and CombinePDF
  • For DOCX: looks like it's not very well supported in Ruby, best I could find is https://www.ruby-toolbox.com/projects/docxgen which simply works on DOCX templates by replacing variables. That would be fine if we only had to replace the names of the spouses and stuff like that, but we're wanting to generate a DOCX from scratch basically. Looks like this is better supported in PHP, perhaps for anyone wanted to download a DOCX we could have a PHP script to help with this:
    • https://github.com/PHPOffice/PHPWord - provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open Document Format for Office Applications (OpenDocument or ODF), Rich Text Format (RTF), HTML, and PDF
@JohnRDOrazio JohnRDOrazio changed the title Final format download Final format output for download Jun 22, 2021
@JohnRDOrazio
Copy link
Collaborator Author

DOCX can also be achieved with NodeJS: https://www.npmjs.com/package/docx .
So I suppose we could choose between PHP or NodeJS as a helper for DOCX generation. My preference is PHP because seems to me to be a little more stable and easier to maintain...

@kas-catholic
Copy link
Collaborator

kas-catholic commented Jun 23, 2021

I think the two most appealing formats to me are .docx (Word) and LaTeX. Docx is appealing because users can edit the file when they're done, and LaTeX is appealing because it's good at generating nicely formatted PDFs that would be ready to print.

Although .docx doesn't have a ton of Ruby support, my understanding of the format is that it is zipped XML. We could create the documents in Word once, save the .docx file as we want it to look, and use string replacement on the XML files from Ruby. This is probably the best approach for formatted output anyway -- I think it would be incredibly hard to get a good-looking document with lots of formatting using only something like PHPWord. Although it might still be nice to interact with the document through an interface like that... calling a PHP script isn't a bad idea to consider.

I think the approach with LaTeX would actually be quite similar. We'd probably want to write the LaTeX source file manually, and then do some kind of string replacement before rendering to PDF.

There are a lot of ways to do the string replacement... Interacting with the XML using an XML library might be an option for the Word doc. An alternative that we might consider is using erb with a template like .tex.erb. We might even be able to use erbs on the internal docx xml files if we wanted to.

@JohnRDOrazio JohnRDOrazio added the question Further information is requested label Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants