This will not work on Prawn 0.2, however.
When it is released, instead, do:
pdf = Prawn::Document.new
pdf.header top_left_point, options do
MoneyPapersController.page_start(pdf)
end
-greg
--
Technical Blaag at: http://blog.majesticseacreature.com | Non-tech
stuff at: http://metametta.blogspot.com
I'm not entirely sure that it should. I'm thinking it may be up to
you to avoid destructive actions in your block, otherwise I'm going to
have to save the entire state of the object on every single page.
For your example, try:
original_font = font.name
font "My new font"
....
font(original_font)
I don't mind adding something like
font "Tempory font" do
...
end
but I'll need to think about it. I know this is a problem, but I
really hate the idea of manually saving the state of the PDF all over
the place. It's a mess.
Don't be rude. Prawn isn't "Too close to alpha software", it's alpha software.
> But I don't understand to where it is heading ? Having the possibility
> to use "destructive" actions in the header is like the basic for my
> use (I know I'm not alone, no problem with that !).
We might be able to do this with some lower level PDF operators. The
issue is mainly that we don't want to save and restore state in Ruby
all the time because it is dog slow and one of the reasons people hate
PDF::Writer.
But... if we can find a way to save state and then restore it later at
the PDF level, we can get a feature like this in without problems.
I'll investigate, but please drop a ticket in Lighthouse with a
request for enhancement to remind me.