Created
June 15, 2015 22:12
-
-
Save EminenceHC/fe6b0afe9b3b3e7aaca0 to your computer and use it in GitHub Desktop.
PDF stylesheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show | |
@intake_agreement = IntakeAgreement.find(params[:id]) | |
respond_to do |format| | |
format.html do | |
render layout: 'pdf' | |
end | |
format.pdf do | |
render pdf: 'filename', | |
layout: 'pdf', | |
template: 'intake_agreements/show.html.erb', | |
#header: { html: { layout: 'pdf_header'}}, | |
header: { html: { template: 'layouts/pdf-header.html.erb', # use :template OR :url | |
}}, | |
footer: { html: { template: 'layouts/pdf-footer.html.erb', # use :template OR :url | |
}}, | |
save_to_file: Rails.root.join('public', 'PDF', 'filename2.pdf') | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"/> | |
<%= wicked_pdf_stylesheet_link_tag "application", media: "all" %> | |
</head> | |
<body> | |
<%= yield(:layout) %> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment