Prawnto, Generating PDF in Rails Applications
Rails wiki lists a number of libraries that can be used to generate PDF files in ruby . Prawnto was very suitable for my need (generating PDF files that contain text with differentfont-size and adding some formatting). Prawn is able to generate more complex PDF documents including adding photos. You can check the installation steps online Prawnto requires you to add code to your controller and to a .prawn layout file. There are several demos available online and can be used as guidance. Below is an example for generating a PDF format of an article. The article has a title and an array of blocks , each block has title and content . The controller code is: def show @title="My Article" @blocks= [ {:title=>'Block One', :content=>'content one'}, {:title=>'Block Two', :content=>'content two'}, ...