prawn-layout 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/examples/example_helper.rb +5 -1
- data/examples/grid/bounding_boxes.rb +21 -0
- data/examples/grid/column_gutter_grid.rb +20 -0
- data/examples/grid/multi_boxes.rb +51 -0
- data/examples/grid/show_grid.rb +13 -0
- data/lib/prawn/layout.rb +1 -1
- data/lib/prawn/layout/grid.rb +36 -18
- data/lib/prawn/table.rb +20 -8
- data/lib/prawn/table/cell.rb +24 -15
- data/spec/spec_helper.rb +2 -1
- data/spec/table_spec.rb +32 -0
- data/vendor/prawn-core/COPYING +340 -0
- data/vendor/prawn-core/HACKING +46 -0
- data/vendor/prawn-core/LICENSE +56 -0
- data/vendor/prawn-core/README +142 -0
- data/vendor/prawn-core/Rakefile +75 -0
- data/vendor/prawn-core/bench/afm_text_bench.rb +18 -0
- data/vendor/prawn-core/bench/png_type_6.rb +15 -0
- data/vendor/prawn-core/bench/ttf_text_bench.rb +19 -0
- data/vendor/prawn-core/bugs/canvas_sets_y_to_0.rb +15 -0
- data/vendor/prawn-core/bugs/png_barcode_issue.rb +11 -0
- data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +15 -0
- data/vendor/prawn-core/data/encodings/win_ansi.txt +29 -0
- data/vendor/prawn-core/data/fonts/Action Man.dfont +0 -0
- data/vendor/prawn-core/data/fonts/Activa.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Chalkboard.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Courier-Bold.afm +342 -0
- data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +342 -0
- data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +342 -0
- data/vendor/prawn-core/data/fonts/Courier.afm +342 -0
- data/vendor/prawn-core/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Dustismo_Roman.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Helvetica-Bold.afm +2827 -0
- data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +2827 -0
- data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +3051 -0
- data/vendor/prawn-core/data/fonts/Helvetica.afm +3051 -0
- data/vendor/prawn-core/data/fonts/MustRead.html +19 -0
- data/vendor/prawn-core/data/fonts/Symbol.afm +213 -0
- data/vendor/prawn-core/data/fonts/Times-Bold.afm +2588 -0
- data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +2384 -0
- data/vendor/prawn-core/data/fonts/Times-Italic.afm +2667 -0
- data/vendor/prawn-core/data/fonts/Times-Roman.afm +2419 -0
- data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +225 -0
- data/vendor/prawn-core/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/gkai00mp.ttf +0 -0
- data/vendor/prawn-core/data/images/16bit.alpha +0 -0
- data/vendor/prawn-core/data/images/16bit.dat +0 -0
- data/vendor/prawn-core/data/images/16bit.png +0 -0
- data/vendor/prawn-core/data/images/arrow.png +0 -0
- data/vendor/prawn-core/data/images/arrow2.png +0 -0
- data/vendor/prawn-core/data/images/barcode_issue.png +0 -0
- data/vendor/prawn-core/data/images/dice.alpha +0 -0
- data/vendor/prawn-core/data/images/dice.dat +0 -0
- data/vendor/prawn-core/data/images/dice.png +0 -0
- data/vendor/prawn-core/data/images/dice_interlaced.png +0 -0
- data/vendor/prawn-core/data/images/fractal.jpg +0 -0
- data/vendor/prawn-core/data/images/letterhead.jpg +0 -0
- data/vendor/prawn-core/data/images/page_white_text.alpha +0 -0
- data/vendor/prawn-core/data/images/page_white_text.dat +0 -0
- data/vendor/prawn-core/data/images/page_white_text.png +0 -0
- data/vendor/prawn-core/data/images/pigs.jpg +0 -0
- data/vendor/prawn-core/data/images/rails.dat +0 -0
- data/vendor/prawn-core/data/images/rails.png +0 -0
- data/vendor/prawn-core/data/images/ruport.png +0 -0
- data/vendor/prawn-core/data/images/ruport_data.dat +0 -0
- data/vendor/prawn-core/data/images/ruport_transparent.png +0 -0
- data/vendor/prawn-core/data/images/ruport_type0.png +0 -0
- data/vendor/prawn-core/data/images/stef.jpg +0 -0
- data/vendor/prawn-core/data/images/tru256.bmp +0 -0
- data/vendor/prawn-core/data/images/web-links.dat +1 -0
- data/vendor/prawn-core/data/images/web-links.png +0 -0
- data/vendor/prawn-core/data/shift_jis_text.txt +1 -0
- data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +43 -0
- data/vendor/prawn-core/examples/bounding_box/indentation.rb +34 -0
- data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +36 -0
- data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +67 -0
- data/vendor/prawn-core/examples/column_box/column_box_example.rb +43 -0
- data/vendor/prawn-core/examples/example_helper.rb +3 -0
- data/vendor/prawn-core/examples/general/background.rb +23 -0
- data/vendor/prawn-core/examples/general/canvas.rb +15 -0
- data/vendor/prawn-core/examples/general/margin.rb +36 -0
- data/vendor/prawn-core/examples/general/measurement_units.rb +51 -0
- data/vendor/prawn-core/examples/general/metadata-info.rb +16 -0
- data/vendor/prawn-core/examples/general/multi_page_layout.rb +18 -0
- data/vendor/prawn-core/examples/general/page_geometry.rb +31 -0
- data/vendor/prawn-core/examples/general/page_numbering.rb +15 -0
- data/vendor/prawn-core/examples/general/stamp.rb +45 -0
- data/vendor/prawn-core/examples/graphics/basic_images.rb +23 -0
- data/vendor/prawn-core/examples/graphics/cmyk.rb +12 -0
- data/vendor/prawn-core/examples/graphics/curves.rb +11 -0
- data/vendor/prawn-core/examples/graphics/hexagon.rb +13 -0
- data/vendor/prawn-core/examples/graphics/image_fit.rb +15 -0
- data/vendor/prawn-core/examples/graphics/image_flow.rb +37 -0
- data/vendor/prawn-core/examples/graphics/image_position.rb +17 -0
- data/vendor/prawn-core/examples/graphics/line.rb +32 -0
- data/vendor/prawn-core/examples/graphics/png_types.rb +22 -0
- data/vendor/prawn-core/examples/graphics/polygons.rb +16 -0
- data/vendor/prawn-core/examples/graphics/remote_images.rb +12 -0
- data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +19 -0
- data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +20 -0
- data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +45 -0
- data/vendor/prawn-core/examples/graphics/stroke_dash.rb +42 -0
- data/vendor/prawn-core/examples/graphics/transparency.rb +26 -0
- data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +19 -0
- data/vendor/prawn-core/examples/m17n/euro.rb +15 -0
- data/vendor/prawn-core/examples/m17n/sjis.rb +28 -0
- data/vendor/prawn-core/examples/m17n/utf8.rb +13 -0
- data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +54 -0
- data/vendor/prawn-core/examples/text/alignment.rb +18 -0
- data/vendor/prawn-core/examples/text/dfont.rb +48 -0
- data/vendor/prawn-core/examples/text/family_based_styling.rb +24 -0
- data/vendor/prawn-core/examples/text/font_calculations.rb +91 -0
- data/vendor/prawn-core/examples/text/font_size.rb +33 -0
- data/vendor/prawn-core/examples/text/kerning.rb +30 -0
- data/vendor/prawn-core/examples/text/simple_text.rb +17 -0
- data/vendor/prawn-core/examples/text/simple_text_ttf.rb +17 -0
- data/vendor/prawn-core/examples/text/span.rb +29 -0
- data/vendor/prawn-core/examples/text/text_box.rb +25 -0
- data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +51 -0
- data/vendor/prawn-core/examples/text/text_flow.rb +67 -0
- data/vendor/prawn-core/lib/prawn/byte_string.rb +7 -0
- data/vendor/prawn-core/lib/prawn/compatibility.rb +38 -0
- data/vendor/prawn-core/lib/prawn/core.rb +85 -0
- data/vendor/prawn-core/lib/prawn/document.rb +534 -0
- data/vendor/prawn-core/lib/prawn/document/annotations.rb +65 -0
- data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +390 -0
- data/vendor/prawn-core/lib/prawn/document/column_box.rb +102 -0
- data/vendor/prawn-core/lib/prawn/document/destinations.rb +92 -0
- data/vendor/prawn-core/lib/prawn/document/internals.rb +180 -0
- data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +153 -0
- data/vendor/prawn-core/lib/prawn/document/snapshot.rb +71 -0
- data/vendor/prawn-core/lib/prawn/document/span.rb +55 -0
- data/vendor/prawn-core/lib/prawn/document/text.rb +184 -0
- data/vendor/prawn-core/lib/prawn/document/text/box.rb +90 -0
- data/vendor/prawn-core/lib/prawn/document/text/wrapping.rb +62 -0
- data/vendor/prawn-core/lib/prawn/encoding.rb +121 -0
- data/vendor/prawn-core/lib/prawn/errors.rb +61 -0
- data/vendor/prawn-core/lib/prawn/font.rb +297 -0
- data/vendor/prawn-core/lib/prawn/font/afm.rb +202 -0
- data/vendor/prawn-core/lib/prawn/font/dfont.rb +34 -0
- data/vendor/prawn-core/lib/prawn/font/ttf.rb +329 -0
- data/vendor/prawn-core/lib/prawn/graphics.rb +264 -0
- data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +35 -0
- data/vendor/prawn-core/lib/prawn/graphics/color.rb +141 -0
- data/vendor/prawn-core/lib/prawn/graphics/dash.rb +69 -0
- data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +35 -0
- data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +56 -0
- data/vendor/prawn-core/lib/prawn/images.rb +339 -0
- data/vendor/prawn-core/lib/prawn/images/jpg.rb +46 -0
- data/vendor/prawn-core/lib/prawn/images/png.rb +219 -0
- data/vendor/prawn-core/lib/prawn/literal_string.rb +14 -0
- data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +46 -0
- data/vendor/prawn-core/lib/prawn/measurements.rb +71 -0
- data/vendor/prawn-core/lib/prawn/name_tree.rb +166 -0
- data/vendor/prawn-core/lib/prawn/object_store.rb +63 -0
- data/vendor/prawn-core/lib/prawn/pdf_object.rb +81 -0
- data/vendor/prawn-core/lib/prawn/reference.rb +72 -0
- data/vendor/prawn-core/lib/prawn/stamp.rb +87 -0
- data/vendor/prawn-core/meta/Rakefile +62 -0
- data/vendor/prawn-core/meta/lib/prawn.rb +2 -0
- data/vendor/prawn-core/reference_pdfs/alignment.pdf +229 -0
- data/vendor/prawn-core/reference_pdfs/background.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/basic_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/bounding_boxes.pdf +128 -0
- data/vendor/prawn-core/reference_pdfs/canvas.pdf +78 -0
- data/vendor/prawn-core/reference_pdfs/chinese_flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/cmyk.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/column_box.pdf +3671 -0
- data/vendor/prawn-core/reference_pdfs/curves.pdf +62 -0
- data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/euro.pdf +75 -0
- data/vendor/prawn-core/reference_pdfs/family_style.pdf +286 -0
- data/vendor/prawn-core/reference_pdfs/flow.pdf +964 -0
- data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/font_size.pdf +142 -0
- data/vendor/prawn-core/reference_pdfs/hexagon.pdf +61 -0
- data/vendor/prawn-core/reference_pdfs/image-flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_fit.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_position.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/indentation.pdf +124 -0
- data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/lines.pdf +116 -0
- data/vendor/prawn-core/reference_pdfs/margin.pdf +3850 -0
- data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +4667 -0
- data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +88 -0
- data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +209 -0
- data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +156 -0
- data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +52 -0
- data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +122 -0
- data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/ruport.pdf +101 -0
- data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +2780 -0
- data/vendor/prawn-core/reference_pdfs/simple_text.pdf +136 -0
- data/vendor/prawn-core/reference_pdfs/simple_text_ttf.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/sjis.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/span.pdf +1975 -0
- data/vendor/prawn-core/reference_pdfs/stamp.pdf +696 -0
- data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +200 -0
- data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +135 -0
- data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +80 -0
- data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +457 -0
- data/vendor/prawn-core/reference_pdfs/text_box.pdf +315 -0
- data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +271 -0
- data/vendor/prawn-core/reference_pdfs/transparency.pdf +347 -0
- data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +6172 -0
- data/vendor/prawn-core/spec/annotations_spec.rb +90 -0
- data/vendor/prawn-core/spec/bounding_box_spec.rb +185 -0
- data/vendor/prawn-core/spec/destinations_spec.rb +15 -0
- data/vendor/prawn-core/spec/document_spec.rb +231 -0
- data/vendor/prawn-core/spec/font_spec.rb +273 -0
- data/vendor/prawn-core/spec/graphics_spec.rb +209 -0
- data/vendor/prawn-core/spec/images_spec.rb +79 -0
- data/vendor/prawn-core/spec/jpg_spec.rb +25 -0
- data/vendor/prawn-core/spec/measurement_units_spec.rb +23 -0
- data/vendor/prawn-core/spec/name_tree_spec.rb +112 -0
- data/vendor/prawn-core/spec/object_store_spec.rb +42 -0
- data/vendor/prawn-core/spec/pdf_object_spec.rb +122 -0
- data/vendor/prawn-core/spec/png_spec.rb +236 -0
- data/vendor/prawn-core/spec/reference_spec.rb +82 -0
- data/vendor/prawn-core/spec/snapshot_spec.rb +115 -0
- data/vendor/prawn-core/spec/span_spec.rb +45 -0
- data/vendor/prawn-core/spec/spec_helper.rb +20 -0
- data/vendor/prawn-core/spec/stamp_spec.rb +98 -0
- data/vendor/prawn-core/spec/stroke_styles_spec.rb +152 -0
- data/vendor/prawn-core/spec/text_box_spec.rb +109 -0
- data/vendor/prawn-core/spec/text_spec.rb +185 -0
- data/vendor/prawn-core/spec/transparency_spec.rb +61 -0
- data/vendor/prawn-core/vendor/pdf-inspector/README +18 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +26 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +18 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +119 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +25 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +31 -0
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +19 -0
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/example.rb +45 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +102 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +88 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +69 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +44 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +78 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +18 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +141 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +46 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +48 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +63 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +51 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +72 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +46 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +34 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +54 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +126 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +79 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +64 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +81 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +37 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +44 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +41 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +47 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +79 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +62 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +43 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +40 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +119 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +78 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +91 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +43 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +35 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +23 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +17 -0
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +14 -0
- data/vendor/prawn-core/www/index.html +196 -0
- data/vendor/prawn-core/www/media/bounding_boxes.pdf +146 -0
- data/vendor/prawn-core/www/media/bounding_boxes.png +0 -0
- data/vendor/prawn-core/www/media/bounding_boxes_out.png +0 -0
- data/vendor/prawn-core/www/media/fancy_table.pdf +350 -0
- data/vendor/prawn-core/www/media/image.pdf +0 -0
- data/vendor/prawn-core/www/media/images.png +0 -0
- data/vendor/prawn-core/www/media/prawn_logo.png +0 -0
- data/vendor/prawn-core/www/media/tables.png +0 -0
- data/vendor/prawn-core/www/media/utf8.pdf +0 -0
- data/vendor/prawn-core/www/media/utf8.png +0 -0
- data/vendor/prawn-core/www/prawn-Chinese.html +113 -0
- data/vendor/prawn-core/www/prawn.css +86 -0
- data/vendor/prawn-core/www/twilight.css +266 -0
- metadata +291 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
|
4
|
+
|
|
5
|
+
class PageAnnotations
|
|
6
|
+
attr_reader :pages
|
|
7
|
+
|
|
8
|
+
def self.parse(document)
|
|
9
|
+
receiver = new
|
|
10
|
+
PDF::Reader.string(document.render, receiver)
|
|
11
|
+
return receiver
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def initialize
|
|
15
|
+
@pages = []
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def begin_page(params)
|
|
19
|
+
@pages << params
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
describe "When creating annotations" do
|
|
24
|
+
|
|
25
|
+
before(:each) { create_pdf }
|
|
26
|
+
|
|
27
|
+
it "should append annotation to current page" do
|
|
28
|
+
@pdf.start_new_page
|
|
29
|
+
@pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
|
|
30
|
+
obj = PageAnnotations.parse(@pdf)
|
|
31
|
+
obj.pages[0][:Annots].nil?.should == true
|
|
32
|
+
obj.pages[1][:Annots].length.should == 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should force :Type to be :Annot" do
|
|
36
|
+
opts = @pdf.annotate(:Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
|
|
37
|
+
opts[:Type].should == :Annot
|
|
38
|
+
opts = @pdf.annotate(:Type => :Bogus, :Rect => [0,0,10,10], :Subtype => :Text, :Contents => "Hello world!")
|
|
39
|
+
opts[:Type].should == :Annot
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
describe "When creating text annotations" do
|
|
45
|
+
|
|
46
|
+
before(:each) do
|
|
47
|
+
@rect = [0,0,10,10]
|
|
48
|
+
@content = "Hello, world!"
|
|
49
|
+
create_pdf
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should build appropriate annotation" do
|
|
53
|
+
opts = @pdf.text_annotation(@rect, @content)
|
|
54
|
+
opts[:Type].should == :Annot
|
|
55
|
+
opts[:Subtype].should == :Text
|
|
56
|
+
opts[:Rect].should == @rect
|
|
57
|
+
opts[:Contents].should == @content
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should merge extra options" do
|
|
61
|
+
opts = @pdf.text_annotation(@rect, @content, :Open => true, :Subtype => :Bogus)
|
|
62
|
+
opts[:Subtype].should == :Text
|
|
63
|
+
opts[:Open].should == true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
describe "When creating link annotations" do
|
|
69
|
+
|
|
70
|
+
before(:each) do
|
|
71
|
+
@rect = [0,0,10,10]
|
|
72
|
+
@dest = "home"
|
|
73
|
+
create_pdf
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should build appropriate annotation" do
|
|
77
|
+
opts = @pdf.link_annotation(@rect, :Dest => @dest)
|
|
78
|
+
opts[:Type].should == :Annot
|
|
79
|
+
opts[:Subtype].should == :Link
|
|
80
|
+
opts[:Rect].should == @rect
|
|
81
|
+
opts[:Dest].should == @dest
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "should merge extra options" do
|
|
85
|
+
opts = @pdf.link_annotation(@rect, :Dest => @dest, :Subtype => :Bogus)
|
|
86
|
+
opts[:Subtype].should == :Link
|
|
87
|
+
opts[:Dest].should == @dest
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
|
4
|
+
|
|
5
|
+
describe "A bounding box" do
|
|
6
|
+
|
|
7
|
+
before(:each) do
|
|
8
|
+
@x = 100
|
|
9
|
+
@y = 125
|
|
10
|
+
@width = 50
|
|
11
|
+
@height = 75
|
|
12
|
+
@box = Prawn::Document::BoundingBox.new(nil, [@x,@y], :width => @width,
|
|
13
|
+
:height => @height )
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "should have an anchor at (x, y - height)" do
|
|
17
|
+
@box.anchor.should == [@x,@y-@height]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it "should have a left boundary of 0" do
|
|
21
|
+
@box.left.should == 0
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should have a right boundary equal to the width" do
|
|
25
|
+
@box.right.should == @width
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "should have a top boundary of height" do
|
|
29
|
+
@box.top.should == @height
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it "should have a bottom boundary of 0" do
|
|
33
|
+
@box.bottom.should == 0
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
it "should have a top-left of [0,height]" do
|
|
37
|
+
@box.top_left.should == [0,@height]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should have a top-right of [width,height]" do
|
|
41
|
+
@box.top_right.should == [@width,@height]
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "should have a bottom-left of [0,0]" do
|
|
45
|
+
@box.bottom_left.should == [0,0]
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should have a bottom-right of [width,0]" do
|
|
49
|
+
@box.bottom_right.should == [@width,0]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "should have an absolute left boundary of x" do
|
|
53
|
+
@box.absolute_left.should == @x
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it "should have an absolute right boundary of x + width" do
|
|
57
|
+
@box.absolute_right.should == @x + @width
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it "should have an absolute top boundary of y" do
|
|
61
|
+
@box.absolute_top.should == @y
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it "should have an absolute bottom boundary of y - height" do
|
|
65
|
+
@box.absolute_bottom.should == @y - @height
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "should have an absolute bottom-left of [x,y-height]" do
|
|
69
|
+
@box.absolute_bottom_left.should == [@x, @y - @height]
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "should have an absolute bottom-right of [x+width,y-height]" do
|
|
73
|
+
@box.absolute_bottom_right.should == [@x + @width , @y - @height]
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should have an absolute top-left of [x,y]" do
|
|
77
|
+
@box.absolute_top_left.should == [@x, @y]
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "should have an absolute top-right of [x+width,y]" do
|
|
81
|
+
@box.absolute_top_right.should == [@x + @width, @y]
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
describe "drawing bounding boxes" do
|
|
88
|
+
|
|
89
|
+
before(:each) { create_pdf }
|
|
90
|
+
|
|
91
|
+
it "should restore the margin box when bounding box exits" do
|
|
92
|
+
margin_box = @pdf.bounds
|
|
93
|
+
|
|
94
|
+
@pdf.bounding_box [100,500] do
|
|
95
|
+
#nothing
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
@pdf.bounds.should == margin_box
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it "should restore the parent bounding box when calls are nested" do
|
|
103
|
+
@pdf.bounding_box [100,500], :width => 300, :height => 300 do
|
|
104
|
+
|
|
105
|
+
@pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
|
|
106
|
+
@pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
|
|
107
|
+
|
|
108
|
+
parent_box = @pdf.bounds
|
|
109
|
+
|
|
110
|
+
@pdf.bounding_box [50,200], :width => 100, :height => 100 do
|
|
111
|
+
@pdf.bounds.absolute_top.should == 200 + parent_box.absolute_bottom
|
|
112
|
+
@pdf.bounds.absolute_left.should == 50 + parent_box.absolute_left
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
@pdf.bounds.absolute_top.should == 500 + @pdf.margin_box.absolute_bottom
|
|
116
|
+
@pdf.bounds.absolute_left.should == 100 + @pdf.margin_box.absolute_left
|
|
117
|
+
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "should calculate a height if none is specified" do
|
|
122
|
+
@pdf.bounding_box([100, 500], :width => 100) do
|
|
123
|
+
@pdf.text "The rain in Spain falls mainly on the plains."
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
@pdf.y.should.be.close 458.384, 0.001
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
it "should keep track of the max height the box was stretched to" do
|
|
130
|
+
box = @pdf.bounding_box(@pdf.bounds.top_left, :width => 100) do
|
|
131
|
+
@pdf.move_down 100
|
|
132
|
+
@pdf.move_up 15
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
assert_equal 100, box.height
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
describe "Indentation" do
|
|
141
|
+
before(:each) { create_pdf }
|
|
142
|
+
|
|
143
|
+
it "should temporarily shift the x coordinate and width" do
|
|
144
|
+
@pdf.bounding_box([100,100], :width => 200) do
|
|
145
|
+
@pdf.indent(20) do
|
|
146
|
+
@pdf.bounds.absolute_left.should == 120
|
|
147
|
+
@pdf.bounds.width.should == 180
|
|
148
|
+
end
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
it "should restore the x coordinate and width after block exits" do
|
|
153
|
+
@pdf.bounding_box([100,100], :width => 200) do
|
|
154
|
+
@pdf.indent(20) do
|
|
155
|
+
# no-op
|
|
156
|
+
end
|
|
157
|
+
@pdf.bounds.absolute_left.should == 100
|
|
158
|
+
@pdf.bounds.width.should == 200
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "should restore the x coordinate and width on error" do
|
|
163
|
+
@pdf.bounding_box([100,100], :width => 200) do
|
|
164
|
+
begin
|
|
165
|
+
@pdf.indent(20) { raise }
|
|
166
|
+
rescue
|
|
167
|
+
@pdf.bounds.absolute_left.should == 100
|
|
168
|
+
@pdf.bounds.width.should == 200
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
describe "A canvas" do
|
|
176
|
+
before(:each) { create_pdf }
|
|
177
|
+
|
|
178
|
+
it "should use whatever the last set y position is" do
|
|
179
|
+
@pdf.canvas do
|
|
180
|
+
@pdf.bounding_box([100,500],:width => 200) { @pdf.move_down 50 }
|
|
181
|
+
end
|
|
182
|
+
@pdf.y.should == 450
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
|
4
|
+
|
|
5
|
+
describe "When creating destinations" do
|
|
6
|
+
|
|
7
|
+
before(:each) { create_pdf }
|
|
8
|
+
|
|
9
|
+
it "should add entry to Dests name tree" do
|
|
10
|
+
@pdf.dests.data.empty?.should == true
|
|
11
|
+
@pdf.add_dest "candy", "chocolate"
|
|
12
|
+
@pdf.dests.data.size.should == 1
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
require "tempfile"
|
|
3
|
+
|
|
4
|
+
require File.join(File.expand_path(File.dirname(__FILE__)), "spec_helper")
|
|
5
|
+
|
|
6
|
+
describe "The cursor" do
|
|
7
|
+
it "should equal pdf.y - bounds.absolute_bottom" do
|
|
8
|
+
pdf = Prawn::Document.new
|
|
9
|
+
pdf.cursor.should == pdf.bounds.top
|
|
10
|
+
|
|
11
|
+
pdf.y = 300
|
|
12
|
+
pdf.cursor.should == pdf.y - pdf.bounds.absolute_bottom
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it "should be able to move relative to the bottom margin" do
|
|
16
|
+
pdf = Prawn::Document.new
|
|
17
|
+
pdf.move_cursor_to(10)
|
|
18
|
+
|
|
19
|
+
pdf.cursor.should == 10
|
|
20
|
+
pdf.y.should == pdf.cursor + pdf.bounds.absolute_bottom
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe "when generating a document from a subclass" do
|
|
25
|
+
it "should be an instance_eval of the subclass" do
|
|
26
|
+
custom_document = Class.new(Prawn::Document)
|
|
27
|
+
custom_document.generate(Tempfile.new("generate_test").path) do |e|
|
|
28
|
+
e.class.should == custom_document
|
|
29
|
+
e.should.be.kind_of(Prawn::Document)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
describe "When creating multi-page documents" do
|
|
36
|
+
|
|
37
|
+
before(:each) { create_pdf }
|
|
38
|
+
|
|
39
|
+
it "should initialize with a single page" do
|
|
40
|
+
page_counter = PDF::Inspector::Page.analyze(@pdf.render)
|
|
41
|
+
|
|
42
|
+
page_counter.pages.size.should == 1
|
|
43
|
+
@pdf.page_count.should == 1
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it "should provide an accurate page_count" do
|
|
47
|
+
3.times { @pdf.start_new_page }
|
|
48
|
+
page_counter = PDF::Inspector::Page.analyze(@pdf.render)
|
|
49
|
+
|
|
50
|
+
page_counter.pages.size.should == 4
|
|
51
|
+
@pdf.page_count.should == 4
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
describe "When beginning each new page" do
|
|
57
|
+
|
|
58
|
+
describe "Background template feature" do
|
|
59
|
+
before(:each) do
|
|
60
|
+
@filename = "#{Prawn::BASEDIR}/data/images/pigs.jpg"
|
|
61
|
+
@pdf = Prawn::Document.new(:background => @filename)
|
|
62
|
+
end
|
|
63
|
+
it "should place a background image if it is in options block" do
|
|
64
|
+
output = @pdf.render
|
|
65
|
+
images = PDF::Inspector::XObject.analyze(output)
|
|
66
|
+
# there should be 2 images in the page resources
|
|
67
|
+
images.page_xobjects.first.size.should == 1
|
|
68
|
+
end
|
|
69
|
+
it "should place a background image if it is in options block" do
|
|
70
|
+
@pdf.instance_variable_defined?(:@background).should == true
|
|
71
|
+
@pdf.instance_variable_get(:@background).should == @filename
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe "When ending each page" do
|
|
78
|
+
|
|
79
|
+
it "should not compress the page content stream if compression is disabled" do
|
|
80
|
+
|
|
81
|
+
pdf = Prawn::Document.new(:compress => false)
|
|
82
|
+
content_stub = pdf.ref!({})
|
|
83
|
+
content_stub.stubs(:compress_stream).returns(true)
|
|
84
|
+
content_stub.expects(:compress_stream).never
|
|
85
|
+
|
|
86
|
+
pdf.instance_variable_set("@page_content", content_stub.identifier)
|
|
87
|
+
pdf.text "Hi There" * 20
|
|
88
|
+
pdf.render
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
it "should compress the page content stream if compression is enabled" do
|
|
92
|
+
|
|
93
|
+
pdf = Prawn::Document.new(:compress => true)
|
|
94
|
+
content_stub = pdf.ref!({})
|
|
95
|
+
content_stub.stubs(:compress_stream).returns(true)
|
|
96
|
+
content_stub.expects(:compress_stream).once
|
|
97
|
+
|
|
98
|
+
pdf.instance_variable_set("@page_content", content_stub.identifier)
|
|
99
|
+
pdf.text "Hi There" * 20
|
|
100
|
+
pdf.render
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "should result in a smaller file size when compressed" do
|
|
104
|
+
doc_uncompressed = Prawn::Document.new
|
|
105
|
+
doc_compressed = Prawn::Document.new(:compress => true)
|
|
106
|
+
[doc_compressed, doc_uncompressed].each do |pdf|
|
|
107
|
+
pdf.font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
|
|
108
|
+
pdf.text "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历" * 10
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
doc_compressed.render.length.should.be < doc_uncompressed.render.length
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
describe "When setting page size" do
|
|
117
|
+
it "should default to LETTER" do
|
|
118
|
+
@pdf = Prawn::Document.new
|
|
119
|
+
pages = PDF::Inspector::Page.analyze(@pdf.render).pages
|
|
120
|
+
pages.first[:size].should == Prawn::Document::PageGeometry::SIZES["LETTER"]
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
(Prawn::Document::PageGeometry::SIZES.keys - ["LETTER"]).each do |k|
|
|
124
|
+
it "should provide #{k} geometry" do
|
|
125
|
+
@pdf = Prawn::Document.new(:page_size => k)
|
|
126
|
+
pages = PDF::Inspector::Page.analyze(@pdf.render).pages
|
|
127
|
+
pages.first[:size].should == Prawn::Document::PageGeometry::SIZES[k]
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it "should allow custom page size" do
|
|
132
|
+
@pdf = Prawn::Document.new(:page_size => [1920, 1080] )
|
|
133
|
+
pages = PDF::Inspector::Page.analyze(@pdf.render).pages
|
|
134
|
+
pages.first[:size].should == [1920, 1080]
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
describe "When setting page layout" do
|
|
140
|
+
it "should reverse coordinates for landscape" do
|
|
141
|
+
@pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
|
|
142
|
+
pages = PDF::Inspector::Page.analyze(@pdf.render).pages
|
|
143
|
+
pages.first[:size].should == Prawn::Document::PageGeometry::SIZES["A4"].reverse
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
describe "The mask() feature" do
|
|
148
|
+
it "should allow transactional restoration of attributes" do
|
|
149
|
+
@pdf = Prawn::Document.new
|
|
150
|
+
y, line_width = @pdf.y, @pdf.line_width
|
|
151
|
+
@pdf.mask(:y, :line_width) do
|
|
152
|
+
@pdf.y = y + 1
|
|
153
|
+
@pdf.line_width = line_width + 1
|
|
154
|
+
@pdf.y.should.not == y
|
|
155
|
+
@pdf.line_width.should.not == line_width
|
|
156
|
+
end
|
|
157
|
+
@pdf.y.should == y
|
|
158
|
+
@pdf.line_width.should == line_width
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
describe "The group() feature" do
|
|
163
|
+
it "should group a simple block on a single page" do
|
|
164
|
+
pdf = Prawn::Document.new do
|
|
165
|
+
self.y = 50
|
|
166
|
+
group do
|
|
167
|
+
text "Hello"
|
|
168
|
+
text "World"
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
pages = PDF::Inspector::Page.analyze(pdf.render).pages
|
|
173
|
+
pages.size.should == 2
|
|
174
|
+
pages[0][:strings].should == []
|
|
175
|
+
pages[1][:strings].should == ["Hello", "World"]
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it "should raise CannotGroup if the content is too tall" do
|
|
179
|
+
lambda {
|
|
180
|
+
Prawn::Document.new do
|
|
181
|
+
group do
|
|
182
|
+
100.times { text "Too long" }
|
|
183
|
+
end
|
|
184
|
+
end.render
|
|
185
|
+
}.should.raise(Prawn::Document::CannotGroup)
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it "should group within individual column boxes" do
|
|
189
|
+
pdf = Prawn::Document.new do
|
|
190
|
+
# Set up columns with grouped blocks of 0..49. 0 to 49 is slightly short
|
|
191
|
+
# of the height of one page / column, so each column should get its own
|
|
192
|
+
# group (every column should start with zero).
|
|
193
|
+
column_box([0, bounds.top], :width => bounds.width, :columns => 7) do
|
|
194
|
+
10.times do
|
|
195
|
+
group { 50.times { |i| text(i.to_s) } }
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
# Second page should start with a 0 because it's a new group.
|
|
201
|
+
pages = PDF::Inspector::Page.analyze(pdf.render).pages
|
|
202
|
+
pages.size.should == 2
|
|
203
|
+
pages[1][:strings].first.should == '0'
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
describe "The render() feature" do
|
|
208
|
+
if "spec".respond_to?(:encode!)
|
|
209
|
+
it "should return a 8 bit encoded string on a m17n aware VM" do
|
|
210
|
+
@pdf = Prawn::Document.new(:page_size => "A4", :page_layout => :landscape)
|
|
211
|
+
@pdf.line [100,100], [200,200]
|
|
212
|
+
str = @pdf.render
|
|
213
|
+
str.encoding.to_s.should == "ASCII-8BIT"
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
describe "PDF file versions" do
|
|
219
|
+
it "should default to 1.3" do
|
|
220
|
+
@pdf = Prawn::Document.new
|
|
221
|
+
str = @pdf.render
|
|
222
|
+
str[0,8].should == "%PDF-1.3"
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
it "should allow the default to be changed" do
|
|
226
|
+
@pdf = Prawn::Document.new
|
|
227
|
+
@pdf.__send__(:min_version, 1.4)
|
|
228
|
+
str = @pdf.render
|
|
229
|
+
str[0,8].should == "%PDF-1.4"
|
|
230
|
+
end
|
|
231
|
+
end
|