-
Notifications
You must be signed in to change notification settings - Fork 426
how to setup for rails
buncis edited this page Nov 13, 2021
·
1 revision
after adding and installing pdfkit in your rails app
you need to add pdfkit middleware in your rails application
application.rb
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1
# Configuration for the application, engines, and railties goes here.
#
# These settings can be overridden in specific environments using the files
# in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
config.middleware.use PDFKit::Middleware
end
then add pdf in your mime type
mime_types.rb
Mime::Type.register "application/pdf", :pdf
restart your application then you could generate the pdf from your pages by adding .pdf at the end of url or set the link_to format with :pdf