-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prawn::Document#on_page_create
in v 1.3.0
#797
Comments
But an immediate fix for 1.3 would be to call |
Thanks for the quick reply, @sandal! We're basically abusing that private API to keep track of which "section" we're in inside of a report to render that in a header. This is some inherited code that inherited so I've not dig in too deep. I'll see if we can do this in a supported way. |
@BrentWheeldon: This may be something we could offer support for (or build a tiny extension for) in the future. See this thread for what I think is a reasonably clean solution: https://groups.google.com/forum/#!topic/prawn-ruby/_KIg4Ih8TdU |
Here's a direct link to the relevant code sample: https://groups.google.com/d/msg/prawn-ruby/_KIg4Ih8TdU/MaHBtDu2F4sJ |
We also use this method in Asciidoctor PDF to paint the background color of the page. Is there another way to accomplish this? |
Maybe not, because repeaters run last, so the z-index is going to be wrong (your background would be rendered on top of the page contents rather than behind them). I'm convinced that restoring |
@mojavelinux: Also, we should think about what first-order support for setting background colors might look like, since it's a tedious operation currently. A patch or feature-request ticket for that is welcome! |
@sandal Thanks for the clarification / input. I'll give it some thought when I upgrade Asciidoctor PDF to the latest Prawn. |
We've also been using on_page_create to prepare a page and create background graphics. It would be nice to either have on_page_create back, or to have a feature that lets repeaters optionally run before the main content is rendered, so the z-order is correct. For example: pdf.repeat(:all, before: true) do
...
end |
@mikesax. For the short term, I'd definitely like to bring back |
Obviously only works for the second page and later, unless you do pass So even if on_page_create is resurected it feels a bit clunky... Repeaters with different z-indexes sounds nice though |
@nathansamson: Yeah, in time for the next release I'm only going to restore the behavior because that's how it's been since basically forever, but that is a good wart to think about dealing with when we produce a better alternative in the future. |
@practicingruby - I submitted PR #825 that delegates the method call to |
Delegate on_page_create method to renderer. #797
Merged! |
👍 Thanks. Used this today in combination with prawn-svg for crisp background image underneath flowing text. |
Hi there,
We have some code that does, effectively:
Since upgrading to 1.3.0 we get:
NoMethodError: undefined method 'on_page_create' for #<Prawn::Document:0x007f92f8a88fd0>
when running this code. I checked the changelog, but didn't see anything about this method, and I can't see it in the source anymore. I can see it that it's been removed fromlib/prawn/document/internals.rb
in b48b206, but it's not clear if there's an alternative?Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: