I need to generate PDF, ready to be printed as report. I use wicked_pdf gem.
My Controller:
render pdf: "file_name", # Excluding ".pdf" extension.
page_size: nil,
page_width: 210,
page_height: 297,
orientation: 'Landscape'
My pdf.erb:
<body onload='number_pages' bgcolor="#ff00FA">
<div style="height: 210mm">
<%= image_tag "https://static.pexels.com/photos/160699/girl-dandelion-yellow-flowers-160699.jpeg", width: "300px"%>
</div>
I made small sample to show my issue (see screenshot below).
I can't figure out how to make pdf without white fields around, I need body to fill all document.
Thank you!
Have you tried setting the margins to 0? Something like:
render pdf: "file_name", # Excluding ".pdf" extension.
page_size: nil,
page_width: 210,
page_height: 297,
orientation: 'Landscape',
margin: {
top: 0, # default 10 (mm)
bottom: 0,
left: 0,
right: 0
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.