i am using rails 4.2 and am generating pdfs in actionmailer with following code:
attachments["abc.pdf"] = WickedPdf.new.pdf_from_string(
render_to_string(template: "pdf_templates/abc.html", header: {
content: render_to_string(layout: "header.html")
}, margin: {
top: 50, left: 50
})
)
mail to: @user.email, subject: "bla blubb"
Its working fine and rendering the abc.html.erb. but it ignores margin-tags and the header file... if i put an error into header.html.erb rails is shouting - so it must be found and processed.
i also tried this but same issue:
pdf = render template: "pdf_templates/abc.html", footer: {spacing: 20, left: "ABDCDSAFASDF"}
attachments["abc.pdf"] = WickedPdf.new.pdf_from_string(pdf)
i read about some problems with ActionMailer but cant solve them, cause i am using rails 4:
wicked_pdf not loading header or footer in ActionMailer
Rails3 - wicked_pdf gem, footer issue when calling from action mailer model