diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2014-01-13 04:17:51 -0700 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2014-01-13 04:17:51 -0700 |
| commit | 623bf5639f525be421a689c57755e6f254b7a127 (patch) | |
| tree | ad4ab29dc5b432c867a0da370619053df7b5e10f /lib | |
| parent | 8ab64ffa6f92d191a0d5ab708650200faa2ad0a6 (diff) | |
set hint to reader to fit document to window
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/asciidoctor/pdf_renderer.rb | 6 | ||||
| -rw-r--r-- | lib/asciidoctor/prawn/extensions.rb | 8 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/asciidoctor/pdf_renderer.rb b/lib/asciidoctor/pdf_renderer.rb index aca9d5af..52fa8aee 100644 --- a/lib/asciidoctor/pdf_renderer.rb +++ b/lib/asciidoctor/pdf_renderer.rb @@ -171,6 +171,7 @@ class PDFRenderer < ::Prawn::Document add_page_numbers skip: (toc_page_nums.size + 1) add_outline doc, num_toc_levels, toc_page_nums + catalog.data[:ViewerPreferences] = [:FitWindow] end def render_title_page doc @@ -936,9 +937,8 @@ class PDFRenderer < ::Prawn::Document document.outline_level self, doc.sections, num_levels, page_num_labels, numbering_offset end - catalog = state.store.root.data - catalog[:PageLabels] = state.store.ref Nums: page_num_labels.flatten - catalog[:PageMode] = :UseOutlines + catalog.data[:PageLabels] = state.store.ref Nums: page_num_labels.flatten + catalog.data[:PageMode] = :UseOutlines nil end diff --git a/lib/asciidoctor/prawn/extensions.rb b/lib/asciidoctor/prawn/extensions.rb index a465a48d..8e7d8b7c 100644 --- a/lib/asciidoctor/prawn/extensions.rb +++ b/lib/asciidoctor/prawn/extensions.rb @@ -3,6 +3,14 @@ module Prawn module Extensions LineMetrics = ::Struct.new :leading, :shift, :height, :final_gap + # Core + + # Retrieves the catalog reference data for the PDF. + # + def catalog + state.store.root + end + # Measurements # Returns the width of the current page from edge-to-edge |
