How do I create a .pdf file efficiently from an HTML template in Rails?

  • casparlee
    Asked on June 19, 2019 at 6:52 AM

    I've found that proper usage of media queries for browser printing is the most effective. If you can't get the result you want: PDF Prawn is a good gem for rendering your data to PDF. 

    I've tried a lot of pdf converters but they just tend to do a mediocre job. They also are a hassle. 

    PDF has restrictions, so when I go to PDF I tend to rethink and ask 'what do these people really want to see in print'?

    People looking to print are typically looking for something very specific. Typically custom reports or charts will end up a better and efficient way to meet requirements.

  • casparlee
    Replied on June 19, 2019 at 6:54 AM

    If you want to use existing PDF as a template, defining areas (bounds, name, type, ...) to be filled later (e.g. with values from Web form), you can use Dhek template editor.

    Created template is saved in open format (JSON), so it can be processed in any language (PHP, Python, Ruby, Java, .Net):  

    Thank You

    Regards

    Caspar Lee | Dissertation Writing Help UK