Howdy,
I've recently started using Prawn, not in anger, but definitely in earnest; I'm converting PDF::Writer documents into Prawn::Documents. I implemented one of our reports as a Spike and was able to accomplish ~99% of the existing document. The piece I wasn't able to directly replicate is a line I have that has one piece of text left-aligned, another piece of text center-aligned, and a third piece of text (which contains my page numbers) right-aligned, all on the same line.
This is my current implementation:
pdf.repeat :all, :dynamic => true do
pdf.bounding_box([pdf.bounds.left, pdf.bounds.bottom + 45], :width => pdf.bounds.right, :height => 45) do
pdf.stroke do
pdf.horizontal_rule
end
pdf.text "I'm on the left side", :align => :left
pdf.text "I'm in the middle", :align => :center
pdf.text "below the middle text", :align => :center
pdf.text "below below the middle text", :align => :center
string = "Page <page> of <total>"
options = {
:at => [pdf.bounds.right - 150, pdf.bounds.bottom + 45],
:width => 150,
:align => :right
}
pdf.number_pages string, options
end
end
It /mostly/ works but "I'm in the middle" isn't on the same line as "I'm on the left side" and "Page <page> of <total>".
Am I missing something? How can I accomplish my goal of having three separately aligned pieces of text, one being for page numbers, all on the same line?
Cheers,
Mel