0
votes

The first page of my PDF is a full width/height image, so I've set margin: 0 while generating my Document

Prawn::Document.generate(FILENAME, margin: 0) do |pdf|
  ...
end

Though I'd like the rest of my PDF to have some margins. I've tried to:

I'm out of ideas and can't find anything related to my problem from the docs (except maybe finding a way to trigger merge_template_options.

Any recommendation to achieve this goal ?

1

1 Answers

0
votes

What version of Prawn are you using? When I ran the code below the first page uses 0 for the margin and after starting a new page with margins, all following pages kept the most recent margins. This way the title page uses the full space and all following pages use normal margins.

Let me know if this behaves differently for you. I'm not able to see how to attach the document it created for me but I could attach a screenshot to compare if needed.

require 'prawn'

pdf = Prawn::Document.new(margin: 0)
pdf.text 'some random example text. page 1'

pdf.start_new_page(margin: 40)
pdf.text 'text with margin'
pdf.move_down 200
pdf.text 'more here'
pdf.move_down 700
pdf.text 'more here2'

pdf.start_new_page
pdf.text 'page 4 here'

pdf.render_file 'ex_file.pdf'