Create PDF Documents In Ruby
PDF (Portable Document Format) is a very popular format which has wide range of uses from invoices to mathematical and scientific journals, which may include images, graphs and other embedded objects. PDF files' most important strength that their formatting looks the same everywhere i.e. all platforms and architectures, unlike other similar format like DOCX, DOC and ODT to name a few.
PDF has a good security features like digitally signing documents for authenticity, encrypt & password protect document to various level of security. This feature has made it an indispensable format, and is widely used by government, banks, law firms, etc. Like, banks send digitally signed statements, law firms & businesses send digitally signed contracts etc.
In this article we will be look at a really nice Ruby gem called Prawn which will be employed to create PDF documents from scratch, though in this article I'll only cover the basics, you can explore it yourself to create whatever you wish to.
Like all Ruby gems, Prawn too is super easy to install, just issue this command on the command line.
Follow the sample code below, I have commented at places to explain what the code snippet is required for.
|All times are GMT +5.5. The time now is 02:29.|