Using a gem to create documents and PDFs can be an important part of any Rails application. While this task is typically done through the asset pipeline, there are a few ways to convert HTML content into PDF format without the use of the asset pipeline. This article will cover several gems that are available to help you convert HTML content into PDFs.
For example, using the pdf_image_tag helper, you can insert images into the PDF file. You can also add a page break after a page has been rendered. There are also a few other options that can help you control the way that the page is rendered. For example, you can set the font size for a certain element, such as the date. You can also add instructions for a controller. The github page for the gem provides more details about the render :pdf options.
Wicked PDF has several features that make it stand out from other PDF gems. For example, the document can be in portrait or landscape mode, and it can be a document generated with or without the use of an asset pipeline. You can also configure the PDF to use a certain domain name. You can also set up a middleware, like Grover, to serve PDFs dynamically. This can make exporting to PDFs easy.
The wicked_pdf gem comes with several configuration options, including the ability to define the PDF’s page breaks. There are also some helpers that provide ways to include stylesheets with the layouts. For example, the wicked_pdf_layout_stylesheet_link_tag helper can be used if you do not use an asset pipeline. You can also set up the PDF to use the domain name that you set in your app configuration.