That +is+ involved... You should be able to use a cell for this,
specifying only a point and a width at a minimum, but it appears like
this is broken in stable. :-/
I'll look into it and see what I can do.
> 2. Drawing a border around the item doesn't seem to work correctly. The top
> border line is below the heading, instead of above.
Are you assuming y=0 is at the top of your document? It isn't.
Are you assuming a rectangle is specified by the bottom left corner? It isn't.
> Also, calculating the
> correct bottom position for the border is not totally straightforward,
> having to look at the height of the image and details sections and move the
> document down if necessary.
This, I feel isn't too bad:
Prawn::Document.generate("border.pdf") do
bounding_box([100,500], :width => 300) do
text "Foo "*100
stroke_rectangle bounds.top_left, bounds.width, bounds.height
end
end
Just remember to manually set the bounding box height, or do your
rectangle drawing *last*
> The other thing I noticed is that tables in bounding boxes without specified
> heights display one row on every page.
Can you produce a simple example and file a defect ticket in
Lighthouse for this? Thanks.
-greg
--
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com
Oh, I see your code now, missed that originally. The answer is that
bounds.top is always going to be the y in bounding_box [x,y], opts
You put your header outside of your bounding box, so you'd actually need:
# Why doesn't pdf.bounds.top include the header section?
pdf.stroke_rectangle [0, pdf.bounds.top + header_height],
item_width, pdf.bounds.height + header_height
I feel like it'd be a little weird to stretch the box as you move
upwards as well as when you move down...
Can you produce a simple example and file a defect ticket in
Lighthouse for this? Thanks.