prawn-layout 0.3.2 → 0.7.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/README +1 -0
- data/Rakefile +6 -3
- data/lib/prawn/layout.rb +1 -1
- data/lib/prawn/layout/page.rb +0 -40
- data/lib/prawn/table/cell.rb +15 -13
- metadata +31 -309
- data/examples/page_layout/flowing_text_with_header_and_footer.rb +0 -36
- data/spec/page_layout_spec.rb +0 -41
- data/vendor/prawn-core/COPYING +0 -340
- data/vendor/prawn-core/HACKING +0 -46
- data/vendor/prawn-core/LICENSE +0 -56
- data/vendor/prawn-core/README +0 -142
- data/vendor/prawn-core/Rakefile +0 -75
- data/vendor/prawn-core/bench/afm_text_bench.rb +0 -18
- data/vendor/prawn-core/bench/png_type_6.rb +0 -15
- data/vendor/prawn-core/bench/ttf_text_bench.rb +0 -19
- data/vendor/prawn-core/bugs/canvas_sets_y_to_0.rb +0 -15
- data/vendor/prawn-core/bugs/png_barcode_issue.rb +0 -11
- data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +0 -15
- data/vendor/prawn-core/data/encodings/win_ansi.txt +0 -29
- 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 +0 -342
- data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier.afm +0 -342
- 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 +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +0 -3051
- data/vendor/prawn-core/data/fonts/Helvetica.afm +0 -3051
- data/vendor/prawn-core/data/fonts/MustRead.html +0 -19
- data/vendor/prawn-core/data/fonts/Symbol.afm +0 -213
- data/vendor/prawn-core/data/fonts/Times-Bold.afm +0 -2588
- data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +0 -2384
- data/vendor/prawn-core/data/fonts/Times-Italic.afm +0 -2667
- data/vendor/prawn-core/data/fonts/Times-Roman.afm +0 -2419
- data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +0 -225
- 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 +0 -1
- data/vendor/prawn-core/data/images/web-links.png +0 -0
- data/vendor/prawn-core/data/shift_jis_text.txt +0 -1
- data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +0 -43
- data/vendor/prawn-core/examples/bounding_box/indentation.rb +0 -34
- data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +0 -36
- data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +0 -67
- data/vendor/prawn-core/examples/column_box/column_box_example.rb +0 -43
- data/vendor/prawn-core/examples/example_helper.rb +0 -3
- data/vendor/prawn-core/examples/general/background.rb +0 -23
- data/vendor/prawn-core/examples/general/canvas.rb +0 -15
- data/vendor/prawn-core/examples/general/margin.rb +0 -36
- data/vendor/prawn-core/examples/general/measurement_units.rb +0 -51
- data/vendor/prawn-core/examples/general/metadata-info.rb +0 -16
- data/vendor/prawn-core/examples/general/multi_page_layout.rb +0 -18
- data/vendor/prawn-core/examples/general/page_geometry.rb +0 -31
- data/vendor/prawn-core/examples/general/page_numbering.rb +0 -15
- data/vendor/prawn-core/examples/general/stamp.rb +0 -45
- data/vendor/prawn-core/examples/graphics/basic_images.rb +0 -23
- data/vendor/prawn-core/examples/graphics/cmyk.rb +0 -12
- data/vendor/prawn-core/examples/graphics/curves.rb +0 -11
- data/vendor/prawn-core/examples/graphics/hexagon.rb +0 -13
- data/vendor/prawn-core/examples/graphics/image_fit.rb +0 -15
- data/vendor/prawn-core/examples/graphics/image_flow.rb +0 -37
- data/vendor/prawn-core/examples/graphics/image_position.rb +0 -17
- data/vendor/prawn-core/examples/graphics/line.rb +0 -32
- data/vendor/prawn-core/examples/graphics/png_types.rb +0 -22
- data/vendor/prawn-core/examples/graphics/polygons.rb +0 -16
- data/vendor/prawn-core/examples/graphics/remote_images.rb +0 -12
- data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +0 -19
- data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +0 -20
- data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +0 -45
- data/vendor/prawn-core/examples/graphics/stroke_dash.rb +0 -42
- data/vendor/prawn-core/examples/graphics/transparency.rb +0 -26
- data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +0 -19
- data/vendor/prawn-core/examples/m17n/euro.rb +0 -15
- data/vendor/prawn-core/examples/m17n/sjis.rb +0 -28
- data/vendor/prawn-core/examples/m17n/utf8.rb +0 -13
- data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +0 -54
- data/vendor/prawn-core/examples/text/alignment.rb +0 -18
- data/vendor/prawn-core/examples/text/dfont.rb +0 -48
- data/vendor/prawn-core/examples/text/family_based_styling.rb +0 -24
- data/vendor/prawn-core/examples/text/font_calculations.rb +0 -91
- data/vendor/prawn-core/examples/text/font_size.rb +0 -33
- data/vendor/prawn-core/examples/text/kerning.rb +0 -30
- data/vendor/prawn-core/examples/text/simple_text.rb +0 -17
- data/vendor/prawn-core/examples/text/simple_text_ttf.rb +0 -17
- data/vendor/prawn-core/examples/text/span.rb +0 -29
- data/vendor/prawn-core/examples/text/text_box.rb +0 -25
- data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +0 -51
- data/vendor/prawn-core/examples/text/text_flow.rb +0 -67
- data/vendor/prawn-core/lib/prawn/byte_string.rb +0 -7
- data/vendor/prawn-core/lib/prawn/compatibility.rb +0 -38
- data/vendor/prawn-core/lib/prawn/core.rb +0 -85
- data/vendor/prawn-core/lib/prawn/document.rb +0 -534
- data/vendor/prawn-core/lib/prawn/document/annotations.rb +0 -65
- data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +0 -390
- data/vendor/prawn-core/lib/prawn/document/column_box.rb +0 -102
- data/vendor/prawn-core/lib/prawn/document/destinations.rb +0 -92
- data/vendor/prawn-core/lib/prawn/document/internals.rb +0 -180
- data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +0 -153
- data/vendor/prawn-core/lib/prawn/document/snapshot.rb +0 -71
- data/vendor/prawn-core/lib/prawn/document/span.rb +0 -55
- data/vendor/prawn-core/lib/prawn/document/text.rb +0 -184
- data/vendor/prawn-core/lib/prawn/document/text/box.rb +0 -90
- data/vendor/prawn-core/lib/prawn/document/text/wrapping.rb +0 -62
- data/vendor/prawn-core/lib/prawn/encoding.rb +0 -121
- data/vendor/prawn-core/lib/prawn/errors.rb +0 -61
- data/vendor/prawn-core/lib/prawn/font.rb +0 -297
- data/vendor/prawn-core/lib/prawn/font/afm.rb +0 -202
- data/vendor/prawn-core/lib/prawn/font/dfont.rb +0 -34
- data/vendor/prawn-core/lib/prawn/font/ttf.rb +0 -329
- data/vendor/prawn-core/lib/prawn/graphics.rb +0 -264
- data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +0 -35
- data/vendor/prawn-core/lib/prawn/graphics/color.rb +0 -141
- data/vendor/prawn-core/lib/prawn/graphics/dash.rb +0 -69
- data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +0 -35
- data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +0 -56
- data/vendor/prawn-core/lib/prawn/images.rb +0 -339
- data/vendor/prawn-core/lib/prawn/images/jpg.rb +0 -46
- data/vendor/prawn-core/lib/prawn/images/png.rb +0 -219
- data/vendor/prawn-core/lib/prawn/literal_string.rb +0 -14
- data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +0 -46
- data/vendor/prawn-core/lib/prawn/measurements.rb +0 -71
- data/vendor/prawn-core/lib/prawn/name_tree.rb +0 -166
- data/vendor/prawn-core/lib/prawn/object_store.rb +0 -63
- data/vendor/prawn-core/lib/prawn/pdf_object.rb +0 -81
- data/vendor/prawn-core/lib/prawn/reference.rb +0 -72
- data/vendor/prawn-core/lib/prawn/stamp.rb +0 -87
- data/vendor/prawn-core/meta/Rakefile +0 -62
- data/vendor/prawn-core/meta/lib/prawn.rb +0 -2
- data/vendor/prawn-core/reference_pdfs/alignment.pdf +0 -229
- 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 +0 -128
- data/vendor/prawn-core/reference_pdfs/canvas.pdf +0 -78
- 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 +0 -3671
- data/vendor/prawn-core/reference_pdfs/curves.pdf +0 -62
- data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/euro.pdf +0 -75
- data/vendor/prawn-core/reference_pdfs/family_style.pdf +0 -286
- data/vendor/prawn-core/reference_pdfs/flow.pdf +0 -964
- data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/font_size.pdf +0 -142
- data/vendor/prawn-core/reference_pdfs/hexagon.pdf +0 -61
- 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 +0 -124
- data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/lines.pdf +0 -116
- data/vendor/prawn-core/reference_pdfs/margin.pdf +0 -3850
- data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +0 -4667
- data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +0 -88
- data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +0 -209
- data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +0 -156
- data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +0 -122
- data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/ruport.pdf +0 -101
- data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +0 -2780
- data/vendor/prawn-core/reference_pdfs/simple_text.pdf +0 -136
- 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 +0 -1975
- data/vendor/prawn-core/reference_pdfs/stamp.pdf +0 -696
- data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +0 -200
- data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +0 -135
- data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +0 -80
- data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +0 -457
- data/vendor/prawn-core/reference_pdfs/text_box.pdf +0 -315
- data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +0 -271
- data/vendor/prawn-core/reference_pdfs/transparency.pdf +0 -347
- data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +0 -6172
- data/vendor/prawn-core/spec/annotations_spec.rb +0 -90
- data/vendor/prawn-core/spec/bounding_box_spec.rb +0 -185
- data/vendor/prawn-core/spec/destinations_spec.rb +0 -15
- data/vendor/prawn-core/spec/document_spec.rb +0 -231
- data/vendor/prawn-core/spec/font_spec.rb +0 -273
- data/vendor/prawn-core/spec/graphics_spec.rb +0 -209
- data/vendor/prawn-core/spec/images_spec.rb +0 -79
- data/vendor/prawn-core/spec/jpg_spec.rb +0 -25
- data/vendor/prawn-core/spec/measurement_units_spec.rb +0 -23
- data/vendor/prawn-core/spec/name_tree_spec.rb +0 -112
- data/vendor/prawn-core/spec/object_store_spec.rb +0 -42
- data/vendor/prawn-core/spec/pdf_object_spec.rb +0 -122
- data/vendor/prawn-core/spec/png_spec.rb +0 -236
- data/vendor/prawn-core/spec/reference_spec.rb +0 -82
- data/vendor/prawn-core/spec/snapshot_spec.rb +0 -115
- data/vendor/prawn-core/spec/span_spec.rb +0 -45
- data/vendor/prawn-core/spec/spec_helper.rb +0 -20
- data/vendor/prawn-core/spec/stamp_spec.rb +0 -98
- data/vendor/prawn-core/spec/stroke_styles_spec.rb +0 -152
- data/vendor/prawn-core/spec/text_box_spec.rb +0 -109
- data/vendor/prawn-core/spec/text_spec.rb +0 -185
- data/vendor/prawn-core/spec/transparency_spec.rb +0 -61
- data/vendor/prawn-core/vendor/pdf-inspector/README +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -26
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -119
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -25
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
- 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 +0 -45
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +0 -102
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
- data/vendor/prawn-core/www/index.html +0 -196
- data/vendor/prawn-core/www/media/bounding_boxes.pdf +0 -146
- 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 +0 -350
- 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 +0 -113
- data/vendor/prawn-core/www/prawn.css +0 -86
- data/vendor/prawn-core/www/twilight.css +0 -266
@@ -1,90 +0,0 @@
|
|
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
|
@@ -1,185 +0,0 @@
|
|
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
|
-
|
@@ -1,15 +0,0 @@
|
|
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
|
@@ -1,231 +0,0 @@
|
|
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
|