Closed 8vius closed 5 years ago
You could try setting the top margin so that it excludes your header area.
This is expected behaviour even if it might seem surprising.
Prawn doesn't really have any layout tools. It' very close to the PDF drawing model. Objects do not push other objects (like they do in HTML, for example). They rather get put wherever the current position is happen to be. Many operation advance current position in a somewhat expected manner but that's about the extent of what is provided by Prawn.
This is even more evident with repeaters. Repeaters are getting applied after everything else. Think of them as being a completely separate pass through all the pages. After your document is finished, Prawn goes through each page and paints over whatever is in the repeaters. So if you want to avoid overlap you have to make sure there's enough blank space for them. One way, as Thomas suggested, would be to add margins. Alternatively, you can specify ac block that would be called right after creating a page with on_page_create
method or on_page_create_callback
option to document constructor.
I'll close this issue now as it's not a bug. Feel free to reopen if you believe it wasn't resolved.
I have some header elements set in the upper corners of my PDFs, a logo and some text, on the first page they look fine since I manually move down to start rendering the table:
But on every other page the top of the table is clipping with these elements:
This is how I'm rendering the logo and header text:
And this is how I'm rendering out the table: