

If you don't know what that means, your application probably isn't thread-safe. This might cause unexpected behavior if your application or dependencies are not thread-safe. Note that this allows concurrent requests served from the same process using threads. In config/environments/development.rb set config.allow_concurrency = true (default in Rails 4).If you don't want to use Passenger you can also do this: However, Passenger does not allow to use debugger or byebug. The easiest fix for this is to use Passenger Standalone for development, which can spawn multiple worker processes. When using a singlethreaded development server like Thin there is no additional worker process available to deliver those assets.
RAILS PDFKIT PDF
To render the PDF additional assets (CSS, images, Javascripts) are required.

The Rails process is trying to render the page to PDF.When using the PDFKit middleware on your development, you might experience that your application "locks up" whenever you request a. Replace: /vendor/wkhtmltopdf/linux-precise-amd64/wkhtmltopdf"ĭeadlock issues on development machine ("PDFKit middleware hangs") Header_spacing: 52.197, # margin_top converted from px => mm (You can see it as "margin-top: -200px")įooter_spacing: 0, # The top left edge of the footer is already at the right position Margin_bottom: '150px', # Height of the footer, can be px or mm Margin_top: '200px', # Height of the header, can be px or mm Header_html: 'app/views/foo/bar/header.html',įooter_html: 'app/views/foo/bar/footer.html', To add your repeated header and footer files, add or modify these attributes in your PDFKit options hash:.You can actually execute JavaScript before the page is rendered to PDF, and implement things like page numbers in the header or footer.PDFKit also comes with some custom options that are hard to express in CSS (or are not supported by the Webkit engine that PDFKit internally uses).for controlling page breaks: page-break-before:always page-break-after:always page-break-inside CSS actually has a few print-related directives, e.g.
RAILS PDFKIT HOW TO
There are concepts and formattings that only make sense on paper, so the question is how to implement them if you only have CSS: How to express page breaks, headers, footers, etc. However, you should always have quiet: true to keep your test output and logs clean. You can get a list of supported options by running man wkhtmltopdf. Most options are forwarded to wkhtmltopdf (see below). # disable_smart_shrinking: true, # Enable to keep the pixel/dpi ratio linearĬonfig.wkhtmltopdf = ('vendor/wkhtmltopdf/linux-trusty-amd64/wkhtmltopdf').to_s No_outline: true, # Disable the default outline Load_media_error_handling: 'abort', # Crash early Load_error_handling: 'abort', # Crash early Quiet: true, # No output during PDF generation
