From 94d70ccde069d7d243eb851bf4a7ca1d31853b12 Mon Sep 17 00:00:00 2001 From: Jesse Doyle Date: Thu, 19 Feb 2015 16:42:53 -0700 Subject: [PATCH 1/2] Delegate on_page_create method to renderer. #797 --- lib/prawn/document/internals.rb | 3 ++- spec/document_spec.rb | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/prawn/document/internals.rb b/lib/prawn/document/internals.rb index c6374afd5..3db7dc946 100644 --- a/lib/prawn/document/internals.rb +++ b/lib/prawn/document/internals.rb @@ -26,7 +26,8 @@ module Internals # Anyway, for now it's not clear what we should do w. them. delegate [ :graphic_state, :save_graphics_state, - :restore_graphics_state ] => :renderer + :restore_graphics_state, + :on_page_create ] => :renderer # FIXME: This is a circular reference, because in theory Prawn should # be passing instances of renderer to PDF::Core::Page, but it's diff --git a/spec/document_spec.rb b/spec/document_spec.rb index 2516ab706..74c758d27 100644 --- a/spec/document_spec.rb +++ b/spec/document_spec.rb @@ -180,6 +180,10 @@ def self.format(string) create_pdf end + it "should be delegated from Document to renderer" do + expect(@pdf.respond_to?(:on_page_create)).to be_true + end + it "should be invoked with document" do called_with = nil From ba7f202c6e018fc8195a5f3264c21346f5de61ff Mon Sep 17 00:00:00 2001 From: Gregory Brown Date: Fri, 20 Feb 2015 11:14:19 -0500 Subject: [PATCH 2/2] Add notes about on_page_create to CHANGELOG --- CHANGELOG.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a9b7941..a2a288c39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,20 @@ should benefit greatly from these changes. (Gregory Brown, [#793](https://github.com/prawnpdf/prawn/pull/793)) +### Temporarily restored the Document#on_page_create method + +This method was moved into PDF::Core in the Prawn 1.3.0 release, removing +it from the `Prawn::Document` API. Although it is a low-level method not +meant for general use, it is necessary for certain tasks that we do not +have proper support for elsewhere. + +This method should still be considered part of Prawn's internals and is subject +to change at any time, but we have restored it temporarily until we have +a suitable replacement for it. See the discussion on [#797](https://github.com/prawnpdf/prawn/issues/797) +for more details. + +(Jesse Doyle, [#797](https://github.com/prawnpdf/prawn/issues/797), [#825](https://github.com/prawnpdf/prawn/pull/825)) + ## PrawnPDF 1.3.0 -- September 28, 2014 ### Added the Prawn::View mixin for using Prawn's DSL in your own classes.