0
votes

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!

screenshot[![]

1

1 Answers

1
votes

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 
  }