Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #364 Issue With Full Template #428

Merged
merged 1 commit into from

2 participants

@jonsgreen
Collaborator

only set /Parent reference for page templates to appease Adobe
Acrobat
correct nested_pages.pdf pages to point to correct parent for Adobe
reader and spec testing purposes

Note: I closed my other pull request and put this one on a branch with a spec added.

@jonsgreen jonsgreen Issue #364 Issue With Full Template
only set /Parent reference for page templates to appease Adobe
Acrobat
correct nested_pages.pdf pages to point to correct parent for Adobe
reader and spec testing purposes
edcc3f6
@bradediger bradediger merged commit 8b39d1d into prawnpdf:master
@bradediger
Collaborator

:+1: Merged. Thanks @jonsgreen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 8, 2012
  1. @jonsgreen

    Issue #364 Issue With Full Template

    jonsgreen authored
    only set /Parent reference for page templates to appease Adobe
    Acrobat
    correct nested_pages.pdf pages to point to correct parent for Adobe
    reader and spec testing purposes
This page is out of date. Refresh to see the latest.
View
BIN  data/pdfs/nested_pages.pdf
Binary file not shown
View
2  lib/prawn/core/page.rb
@@ -160,7 +160,7 @@ def dimensions
def init_from_object(options)
@dictionary = options[:object_id].to_i
- dictionary.data[:Parent] = document.state.store.pages
+ dictionary.data[:Parent] = document.state.store.pages if options[:page_template]
unless dictionary.data[:Contents].is_a?(Array) # content only on leafs
@content = dictionary.data[:Contents].identifier
View
2  lib/prawn/document.rb
@@ -646,7 +646,7 @@ def compression_enabled?
def merge_template_options(page_options, options)
object_id = state.store.import_page(options[:template], options[:template_page] || 1)
- page_options.merge!(:object_id => object_id )
+ page_options.merge!(:object_id => object_id, :page_template => true)
end
# setting override_settings to true ensures that a new graphic state does not end up using
View
7 spec/template_spec.rb
@@ -9,6 +9,13 @@
page_counter.pages.size.should == 1
end
+ it "should not set the template page's parent to the document pages catalog (especially with nested pages)" do
+ filename = "#{Prawn::DATADIR}/pdfs/nested_pages.pdf"
+ @pdf = Prawn::Document.new(:template => filename, :skip_page_creation => true)
+ assert @pdf.state.page.dictionary.data[:Parent] != @pdf.state.store.pages
+ end
+
+
it "should have start with the Y cursor at the top of the document" do
filename = "#{Prawn::BASEDIR}/spec/data/curves.pdf"
Something went wrong with that request. Please try again.