prawn 0.13.0 → 2.4.0
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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/.yardopts +10 -0
- data/GPLv2 +20 -21
- data/Gemfile +3 -16
- data/Rakefile +17 -39
- data/lib/prawn/document/bounding_box.rb +85 -42
- data/lib/prawn/document/column_box.rb +21 -11
- data/lib/prawn/document/internals.rb +40 -147
- data/lib/prawn/document/span.rb +25 -17
- data/lib/prawn/document.rb +286 -245
- data/lib/prawn/encoding.rb +68 -101
- data/lib/prawn/errors.rb +47 -43
- data/lib/prawn/font.rb +204 -155
- data/lib/prawn/font_metric_cache.rb +25 -21
- data/lib/prawn/fonts/afm.rb +292 -0
- data/lib/prawn/{font → fonts}/dfont.rb +7 -13
- data/lib/prawn/fonts/otf.rb +11 -0
- data/lib/prawn/fonts/ttc.rb +36 -0
- data/lib/prawn/{font → fonts}/ttf.rb +142 -80
- data/lib/prawn/graphics/blend_mode.rb +65 -0
- data/lib/prawn/graphics/cap_style.rb +6 -5
- data/lib/prawn/graphics/color.rb +47 -44
- data/lib/prawn/graphics/dash.rb +30 -13
- data/lib/prawn/graphics/join_style.rb +13 -6
- data/lib/prawn/graphics/patterns.rb +221 -90
- data/lib/prawn/graphics/transformation.rb +21 -12
- data/lib/prawn/graphics/transparency.rb +21 -17
- data/lib/prawn/graphics.rb +155 -128
- data/lib/prawn/{layout/grid.rb → grid.rb} +110 -47
- data/lib/prawn/image_handler.rb +16 -2
- data/lib/prawn/images/image.rb +4 -2
- data/lib/prawn/images/jpg.rb +39 -30
- data/lib/prawn/images/png.rb +132 -169
- data/lib/prawn/images.rb +70 -62
- data/lib/prawn/measurement_extensions.rb +15 -10
- data/lib/prawn/measurements.rb +22 -23
- data/lib/prawn/outline.rb +301 -13
- data/lib/prawn/repeater.rb +19 -17
- data/lib/prawn/security/arcfour.rb +54 -0
- data/lib/prawn/security.rb +108 -86
- data/lib/prawn/soft_mask.rb +40 -41
- data/lib/prawn/stamp.rb +29 -12
- data/lib/prawn/text/box.rb +27 -29
- data/lib/prawn/text/formatted/arranger.rb +110 -67
- data/lib/prawn/text/formatted/box.rb +233 -165
- data/lib/prawn/text/formatted/fragment.rb +27 -27
- data/lib/prawn/text/formatted/line_wrap.rb +137 -97
- data/lib/prawn/text/formatted/parser.rb +149 -127
- data/lib/prawn/text/formatted/wrap.rb +57 -37
- data/lib/prawn/text/formatted.rb +6 -4
- data/lib/prawn/text.rb +105 -73
- data/lib/prawn/transformation_stack.rb +44 -0
- data/lib/prawn/utilities.rb +11 -21
- data/lib/prawn/version.rb +5 -0
- data/lib/prawn/view.rb +101 -0
- data/lib/prawn.rb +42 -68
- data/{data/images/fractal.jpg → manual/absolute_position.pdf} +0 -0
- data/manual/basic_concepts/adding_pages.rb +9 -10
- data/manual/basic_concepts/basic_concepts.rb +33 -24
- data/manual/basic_concepts/creation.rb +10 -11
- data/manual/basic_concepts/cursor.rb +9 -10
- data/manual/basic_concepts/measurement.rb +10 -11
- data/manual/basic_concepts/origin.rb +8 -9
- data/manual/basic_concepts/other_cursor_helpers.rb +17 -18
- data/manual/basic_concepts/view.rb +48 -0
- data/manual/bounding_box/bounding_box.rb +31 -29
- data/manual/bounding_box/bounds.rb +17 -18
- data/manual/bounding_box/canvas.rb +8 -9
- data/manual/bounding_box/creation.rb +8 -9
- data/manual/bounding_box/indentation.rb +22 -23
- data/manual/bounding_box/nesting.rb +32 -25
- data/manual/bounding_box/russian_boxes.rb +19 -19
- data/manual/bounding_box/stretchy.rb +18 -20
- data/manual/contents.rb +35 -0
- data/manual/cover.rb +43 -0
- data/manual/document_and_page_options/background.rb +16 -14
- data/manual/document_and_page_options/document_and_page_options.rb +26 -23
- data/manual/document_and_page_options/metadata.rb +21 -19
- data/manual/document_and_page_options/page_margins.rb +20 -22
- data/manual/document_and_page_options/page_size.rb +15 -15
- data/manual/document_and_page_options/print_scaling.rb +23 -0
- data/manual/example_helper.rb +5 -408
- data/manual/graphics/blend_mode.rb +52 -0
- data/manual/graphics/circle_and_ellipse.rb +8 -9
- data/manual/graphics/color.rb +11 -13
- data/manual/graphics/common_lines.rb +13 -12
- data/manual/graphics/fill_and_stroke.rb +10 -11
- data/manual/graphics/fill_rules.rb +13 -12
- data/manual/graphics/gradients.rb +28 -22
- data/manual/graphics/graphics.rb +52 -46
- data/manual/graphics/helper.rb +20 -10
- data/manual/graphics/line_width.rb +13 -12
- data/manual/graphics/lines_and_curves.rb +13 -14
- data/manual/graphics/polygon.rb +10 -12
- data/manual/graphics/rectangle.rb +7 -8
- data/manual/graphics/rotate.rb +9 -12
- data/manual/graphics/scale.rb +19 -18
- data/manual/graphics/soft_masks.rb +5 -7
- data/manual/graphics/stroke_cap.rb +10 -11
- data/manual/graphics/stroke_dash.rb +16 -17
- data/manual/graphics/stroke_join.rb +10 -11
- data/manual/graphics/translate.rb +13 -13
- data/manual/graphics/transparency.rb +11 -13
- data/manual/{manual/how_to_read_this_manual.rb → how_to_read_this_manual.rb} +23 -25
- data/manual/images/absolute_position.rb +9 -10
- data/manual/images/fit.rb +9 -10
- data/manual/images/horizontal.rb +13 -14
- data/manual/images/images.rb +31 -30
- data/manual/images/plain_image.rb +6 -7
- data/manual/images/scale.rb +12 -13
- data/manual/images/vertical.rb +19 -17
- data/manual/images/width_and_height.rb +13 -14
- data/manual/layout/boxes.rb +14 -15
- data/manual/layout/content.rb +12 -13
- data/manual/layout/layout.rb +19 -20
- data/manual/layout/simple_grid.rb +8 -9
- data/manual/outline/add_subsection_to.rb +26 -27
- data/manual/outline/insert_section_after.rb +19 -20
- data/manual/outline/outline.rb +23 -22
- data/manual/outline/sections_and_pages.rb +24 -25
- data/manual/repeatable_content/alternate_page_numbering.rb +36 -0
- data/manual/repeatable_content/page_numbering.rb +20 -19
- data/manual/repeatable_content/repeatable_content.rb +26 -22
- data/manual/repeatable_content/repeater.rb +18 -19
- data/manual/repeatable_content/stamp.rb +18 -19
- data/manual/security/encryption.rb +8 -11
- data/manual/security/permissions.rb +20 -15
- data/manual/security/security.rb +20 -20
- data/manual/table.rb +16 -0
- data/manual/text/alignment.rb +17 -18
- data/manual/text/color.rb +13 -13
- data/manual/text/column_box.rb +10 -12
- data/manual/text/fallback_fonts.rb +29 -25
- data/manual/text/font.rb +17 -18
- data/manual/text/font_size.rb +21 -22
- data/manual/text/font_style.rb +12 -10
- data/manual/text/formatted_callbacks.rb +36 -26
- data/manual/text/formatted_text.rb +41 -34
- data/manual/text/free_flowing_text.rb +28 -29
- data/manual/text/inline.rb +23 -26
- data/manual/text/kerning_and_character_spacing.rb +20 -21
- data/manual/text/leading.rb +10 -11
- data/manual/text/line_wrapping.rb +40 -21
- data/manual/text/paragraph_indentation.rb +17 -12
- data/manual/text/positioned_text.rb +19 -20
- data/manual/text/registering_families.rb +33 -30
- data/manual/text/rendering_and_color.rb +11 -12
- data/manual/text/right_to_left_text.rb +31 -20
- data/manual/text/rotation.rb +36 -27
- data/manual/text/single_usage.rb +13 -14
- data/manual/text/text.rb +62 -62
- data/manual/text/text_box_excess.rb +22 -19
- data/manual/text/text_box_extensions.rb +21 -18
- data/manual/text/text_box_overflow.rb +28 -21
- data/manual/text/utf8.rb +16 -17
- data/manual/text/win_ansi_charset.rb +29 -26
- data/prawn.gemspec +45 -43
- data/spec/extensions/encoding_helpers.rb +4 -3
- data/spec/prawn/document/bounding_box_spec.rb +550 -0
- data/spec/prawn/document/column_box_spec.rb +75 -0
- data/spec/prawn/document/security_spec.rb +176 -0
- data/spec/prawn/document_annotations_spec.rb +76 -0
- data/spec/prawn/document_destinations_spec.rb +15 -0
- data/spec/prawn/document_grid_spec.rb +99 -0
- data/spec/prawn/document_reference_spec.rb +27 -0
- data/spec/prawn/document_span_spec.rb +44 -0
- data/spec/prawn/document_spec.rb +805 -0
- data/spec/prawn/font_metric_cache_spec.rb +54 -0
- data/spec/prawn/font_spec.rb +544 -0
- data/spec/prawn/graphics/blend_mode_spec.rb +63 -0
- data/spec/prawn/graphics/transparency_spec.rb +81 -0
- data/spec/prawn/graphics_spec.rb +872 -0
- data/spec/prawn/graphics_stroke_styles_spec.rb +229 -0
- data/spec/prawn/image_handler_spec.rb +53 -0
- data/spec/prawn/images/jpg_spec.rb +20 -0
- data/spec/prawn/images/png_spec.rb +283 -0
- data/spec/prawn/images_spec.rb +229 -0
- data/spec/prawn/measurements_extensions_spec.rb +24 -0
- data/spec/prawn/outline_spec.rb +512 -0
- data/spec/prawn/repeater_spec.rb +166 -0
- data/spec/prawn/soft_mask_spec.rb +74 -0
- data/spec/prawn/stamp_spec.rb +173 -0
- data/spec/prawn/text/box_spec.rb +1110 -0
- data/spec/prawn/text/formatted/arranger_spec.rb +466 -0
- data/spec/prawn/text/formatted/box_spec.rb +849 -0
- data/spec/prawn/text/formatted/fragment_spec.rb +343 -0
- data/spec/prawn/text/formatted/line_wrap_spec.rb +495 -0
- data/spec/prawn/text/formatted/parser_spec.rb +697 -0
- data/spec/prawn/text_draw_text_spec.rb +150 -0
- data/spec/prawn/text_rendering_mode_spec.rb +48 -0
- data/spec/prawn/text_spacing_spec.rb +95 -0
- data/spec/prawn/text_spec.rb +603 -0
- data/spec/prawn/text_with_inline_formatting_spec.rb +35 -0
- data/spec/prawn/transformation_stack_spec.rb +66 -0
- data/spec/prawn/view_spec.rb +63 -0
- data/spec/prawn_manual_spec.rb +35 -0
- data/spec/spec_helper.rb +22 -21
- data.tar.gz.sig +0 -0
- metadata +168 -307
- metadata.gz.sig +0 -0
- data/README.md +0 -109
- data/data/encodings/win_ansi.txt +0 -29
- data/data/images/16bit.alpha +0 -0
- data/data/images/16bit.dat +0 -0
- data/data/images/16bit.png +0 -0
- data/data/images/arrow.png +0 -0
- data/data/images/arrow2.png +0 -0
- data/data/images/barcode_issue.png +0 -0
- data/data/images/dice.alpha +0 -0
- data/data/images/dice.dat +0 -0
- data/data/images/dice.png +0 -0
- data/data/images/dice_interlaced.png +0 -0
- data/data/images/indexed_color.dat +0 -0
- data/data/images/indexed_color.png +0 -0
- data/data/images/letterhead.jpg +0 -0
- data/data/images/page_white_text.alpha +0 -0
- data/data/images/page_white_text.dat +0 -0
- data/data/images/page_white_text.png +0 -0
- data/data/images/pigs.jpg +0 -0
- data/data/images/prawn.png +0 -0
- data/data/images/ruport.png +0 -0
- data/data/images/ruport_data.dat +0 -0
- data/data/images/ruport_transparent.png +0 -0
- data/data/images/ruport_type0.png +0 -0
- data/data/images/stef.jpg +0 -0
- data/data/images/tru256.bmp +0 -0
- data/data/images/web-links.dat +0 -1
- data/data/images/web-links.png +0 -0
- data/data/pdfs/complex_template.pdf +0 -0
- data/data/pdfs/contains_ttf_font.pdf +0 -0
- data/data/pdfs/encrypted.pdf +0 -0
- data/data/pdfs/form.pdf +1 -819
- data/data/pdfs/hexagon.pdf +0 -61
- data/data/pdfs/indirect_reference.pdf +0 -86
- data/data/pdfs/multipage_template.pdf +0 -127
- data/data/pdfs/nested_pages.pdf +0 -118
- data/data/pdfs/page_without_mediabox.pdf +0 -193
- data/data/pdfs/resources_as_indirect_object.pdf +0 -83
- data/data/pdfs/two_hexagons.pdf +0 -90
- data/data/pdfs/version_1_6.pdf +0 -61
- data/data/shift_jis_text.txt +0 -1
- data/lib/pdf/core/annotations.rb +0 -60
- data/lib/pdf/core/byte_string.rb +0 -9
- data/lib/pdf/core/destinations.rb +0 -90
- data/lib/pdf/core/document_state.rb +0 -78
- data/lib/pdf/core/filter_list.rb +0 -51
- data/lib/pdf/core/filters.rb +0 -36
- data/lib/pdf/core/graphics_state.rb +0 -68
- data/lib/pdf/core/literal_string.rb +0 -16
- data/lib/pdf/core/name_tree.rb +0 -177
- data/lib/pdf/core/object_store.rb +0 -320
- data/lib/pdf/core/outline.rb +0 -315
- data/lib/pdf/core/page.rb +0 -212
- data/lib/pdf/core/page_geometry.rb +0 -126
- data/lib/pdf/core/pdf_object.rb +0 -124
- data/lib/pdf/core/reference.rb +0 -103
- data/lib/pdf/core/stream.rb +0 -98
- data/lib/pdf/core/text.rb +0 -275
- data/lib/pdf/core.rb +0 -35
- data/lib/prawn/compatibility.rb +0 -91
- data/lib/prawn/document/graphics_state.rb +0 -73
- data/lib/prawn/document/snapshot.rb +0 -89
- data/lib/prawn/font/afm.rb +0 -203
- data/lib/prawn/layout.rb +0 -20
- data/lib/prawn/table/cell/image.rb +0 -70
- data/lib/prawn/table/cell/in_table.rb +0 -27
- data/lib/prawn/table/cell/span_dummy.rb +0 -92
- data/lib/prawn/table/cell/subtable.rb +0 -65
- data/lib/prawn/table/cell/text.rb +0 -153
- data/lib/prawn/table/cell.rb +0 -770
- data/lib/prawn/table/cells.rb +0 -295
- data/lib/prawn/table.rb +0 -643
- data/manual/example_file.rb +0 -116
- data/manual/example_package.rb +0 -53
- data/manual/example_section.rb +0 -46
- data/manual/manual/cover.rb +0 -35
- data/manual/manual/foreword.rb +0 -85
- data/manual/manual/manual.rb +0 -35
- data/manual/syntax_highlight.rb +0 -52
- data/manual/table/basic_block.rb +0 -53
- data/manual/table/before_rendering_page.rb +0 -26
- data/manual/table/cell_border_lines.rb +0 -24
- data/manual/table/cell_borders_and_bg.rb +0 -31
- data/manual/table/cell_dimensions.rb +0 -30
- data/manual/table/cell_text.rb +0 -38
- data/manual/table/column_widths.rb +0 -30
- data/manual/table/content_and_subtables.rb +0 -39
- data/manual/table/creation.rb +0 -27
- data/manual/table/filtering.rb +0 -36
- data/manual/table/flow_and_header.rb +0 -17
- data/manual/table/image_cells.rb +0 -33
- data/manual/table/position.rb +0 -29
- data/manual/table/row_colors.rb +0 -20
- data/manual/table/span.rb +0 -30
- data/manual/table/style.rb +0 -22
- data/manual/table/table.rb +0 -52
- data/manual/table/width.rb +0 -27
- data/manual/templates/full_template.rb +0 -25
- data/manual/templates/page_template.rb +0 -48
- data/manual/templates/templates.rb +0 -27
- data/manual/text/group.rb +0 -29
- data/spec/acceptance/png.rb +0 -23
- data/spec/annotations_spec.rb +0 -74
- data/spec/bounding_box_spec.rb +0 -493
- data/spec/cell_spec.rb +0 -628
- data/spec/column_box_spec.rb +0 -33
- data/spec/destinations_spec.rb +0 -15
- data/spec/document_spec.rb +0 -761
- data/spec/extensions/mocha.rb +0 -44
- data/spec/filters_spec.rb +0 -34
- data/spec/font_metric_cache_spec.rb +0 -52
- data/spec/font_spec.rb +0 -464
- data/spec/formatted_text_arranger_spec.rb +0 -421
- data/spec/formatted_text_box_spec.rb +0 -650
- data/spec/formatted_text_fragment_spec.rb +0 -298
- data/spec/graphics_spec.rb +0 -651
- data/spec/grid_spec.rb +0 -85
- data/spec/image_handler_spec.rb +0 -42
- data/spec/images_spec.rb +0 -157
- data/spec/inline_formatted_text_parser_spec.rb +0 -564
- data/spec/jpg_spec.rb +0 -25
- data/spec/line_wrap_spec.rb +0 -333
- data/spec/measurement_units_spec.rb +0 -23
- data/spec/name_tree_spec.rb +0 -112
- data/spec/object_store_spec.rb +0 -170
- data/spec/outline_spec.rb +0 -448
- data/spec/pdf_object_spec.rb +0 -172
- data/spec/png_spec.rb +0 -240
- data/spec/reference_spec.rb +0 -82
- data/spec/repeater_spec.rb +0 -158
- data/spec/security_spec.rb +0 -158
- data/spec/snapshot_spec.rb +0 -186
- data/spec/soft_mask_spec.rb +0 -117
- data/spec/span_spec.rb +0 -44
- data/spec/stamp_spec.rb +0 -158
- data/spec/stream_spec.rb +0 -58
- data/spec/stroke_styles_spec.rb +0 -211
- data/spec/table/span_dummy_spec.rb +0 -17
- data/spec/table_spec.rb +0 -1355
- data/spec/template_spec.rb +0 -351
- data/spec/text_at_spec.rb +0 -130
- data/spec/text_box_spec.rb +0 -1030
- data/spec/text_rendering_mode_spec.rb +0 -45
- data/spec/text_spacing_spec.rb +0 -93
- data/spec/text_spec.rb +0 -425
- data/spec/text_with_inline_formatting_spec.rb +0 -35
- data/spec/transparency_spec.rb +0 -89
data/data/pdfs/two_hexagons.pdf
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
%PDF-1.3
|
2
|
-
%����
|
3
|
-
1 0 obj
|
4
|
-
<< /Creator (Prawn)
|
5
|
-
/Producer (Prawn)
|
6
|
-
>>
|
7
|
-
endobj
|
8
|
-
2 0 obj
|
9
|
-
<< /Count 2
|
10
|
-
/Kids [5 0 R 7 0 R]
|
11
|
-
/Type /Pages
|
12
|
-
>>
|
13
|
-
endobj
|
14
|
-
3 0 obj
|
15
|
-
<< /Type /Catalog
|
16
|
-
/Pages 2 0 R
|
17
|
-
>>
|
18
|
-
endobj
|
19
|
-
4 0 obj
|
20
|
-
<< /Length 195
|
21
|
-
>>
|
22
|
-
stream
|
23
|
-
0.000 0.000 0.000 rg
|
24
|
-
0.000 0.000 0.000 RG
|
25
|
-
q
|
26
|
-
1.000 0.000 0.000 rg
|
27
|
-
136.000 286.000 m
|
28
|
-
236.000 336.000 l
|
29
|
-
336.000 286.000 l
|
30
|
-
336.000 186.000 l
|
31
|
-
236.000 136.000 l
|
32
|
-
136.000 186.000 l
|
33
|
-
136.000 286.000 l
|
34
|
-
f
|
35
|
-
Q
|
36
|
-
|
37
|
-
endstream
|
38
|
-
endobj
|
39
|
-
5 0 obj
|
40
|
-
<< /Contents 4 0 R
|
41
|
-
/Parent 2 0 R
|
42
|
-
/MediaBox [0 0 612.0 792.0]
|
43
|
-
/Type /Page
|
44
|
-
>>
|
45
|
-
endobj
|
46
|
-
6 0 obj
|
47
|
-
<< /Length 195
|
48
|
-
>>
|
49
|
-
stream
|
50
|
-
1.000 0.000 0.000 rg
|
51
|
-
0.000 0.000 0.000 RG
|
52
|
-
q
|
53
|
-
1.000 0.000 0.000 rg
|
54
|
-
136.000 286.000 m
|
55
|
-
236.000 336.000 l
|
56
|
-
336.000 286.000 l
|
57
|
-
336.000 186.000 l
|
58
|
-
236.000 136.000 l
|
59
|
-
136.000 186.000 l
|
60
|
-
136.000 286.000 l
|
61
|
-
f
|
62
|
-
Q
|
63
|
-
|
64
|
-
endstream
|
65
|
-
endobj
|
66
|
-
7 0 obj
|
67
|
-
<< /Contents 6 0 R
|
68
|
-
/Parent 2 0 R
|
69
|
-
/MediaBox [0 0 612.0 792.0]
|
70
|
-
/Type /Page
|
71
|
-
>>
|
72
|
-
endobj
|
73
|
-
xref
|
74
|
-
0 8
|
75
|
-
0000000000 65535 f
|
76
|
-
0000000015 00000 n
|
77
|
-
0000000071 00000 n
|
78
|
-
0000000134 00000 n
|
79
|
-
0000000183 00000 n
|
80
|
-
0000000429 00000 n
|
81
|
-
0000000520 00000 n
|
82
|
-
0000000766 00000 n
|
83
|
-
trailer
|
84
|
-
<< /Info 1 0 R
|
85
|
-
/Root 3 0 R
|
86
|
-
/Size 8
|
87
|
-
>>
|
88
|
-
startxref
|
89
|
-
857
|
90
|
-
%%EOF
|
data/data/pdfs/version_1_6.pdf
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
%PDF-1.6
|
2
|
-
%????
|
3
|
-
1 0 obj
|
4
|
-
<< /Creator (Prawn)
|
5
|
-
/Producer (Prawn)
|
6
|
-
>>
|
7
|
-
endobj
|
8
|
-
2 0 obj
|
9
|
-
<< /Kids [5 0 R]
|
10
|
-
/Type /Pages
|
11
|
-
/Count 1
|
12
|
-
>>
|
13
|
-
endobj
|
14
|
-
3 0 obj
|
15
|
-
<< /Type /Catalog
|
16
|
-
/Pages 2 0 R
|
17
|
-
>>
|
18
|
-
endobj
|
19
|
-
4 0 obj
|
20
|
-
<< /Length 195
|
21
|
-
>>
|
22
|
-
stream
|
23
|
-
0.000 0.000 0.000 rg
|
24
|
-
0.000 0.000 0.000 RG
|
25
|
-
q
|
26
|
-
1.000 0.000 0.000 rg
|
27
|
-
136.000 286.000 m
|
28
|
-
236.000 336.000 l
|
29
|
-
336.000 286.000 l
|
30
|
-
336.000 186.000 l
|
31
|
-
236.000 136.000 l
|
32
|
-
136.000 186.000 l
|
33
|
-
136.000 286.000 l
|
34
|
-
f
|
35
|
-
Q
|
36
|
-
|
37
|
-
endstream
|
38
|
-
endobj
|
39
|
-
5 0 obj
|
40
|
-
<< /Contents 4 0 R
|
41
|
-
/Type /Page
|
42
|
-
/MediaBox [0 0 612.0 792.0]
|
43
|
-
/Parent 2 0 R
|
44
|
-
>>
|
45
|
-
endobj
|
46
|
-
xref
|
47
|
-
0 6
|
48
|
-
0000000000 65535 f
|
49
|
-
0000000015 00000 n
|
50
|
-
0000000071 00000 n
|
51
|
-
0000000128 00000 n
|
52
|
-
0000000177 00000 n
|
53
|
-
0000000423 00000 n
|
54
|
-
trailer
|
55
|
-
<< /Info 1 0 R
|
56
|
-
/Size 6
|
57
|
-
/Root 3 0 R
|
58
|
-
>>
|
59
|
-
startxref
|
60
|
-
514
|
61
|
-
%%EOF
|
data/data/shift_jis_text.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
���C���y�[�W
|
data/lib/pdf/core/annotations.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# annotations.rb : Implements low-level annotation support for PDF
|
4
|
-
#
|
5
|
-
# Copyright November 2008, Jamis Buck. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
|
-
#
|
9
|
-
module PDF
|
10
|
-
module Core
|
11
|
-
# Provides very low-level support for annotations.
|
12
|
-
#
|
13
|
-
module Annotations #:nodoc:
|
14
|
-
|
15
|
-
# Adds a new annotation (section 8.4 in PDF spec) to the current page.
|
16
|
-
# +options+ must be a Hash describing the annotation.
|
17
|
-
#
|
18
|
-
def annotate(options)
|
19
|
-
state.page.dictionary.data[:Annots] ||= []
|
20
|
-
options = sanitize_annotation_hash(options)
|
21
|
-
state.page.dictionary.data[:Annots] << ref!(options)
|
22
|
-
return options
|
23
|
-
end
|
24
|
-
|
25
|
-
# A convenience method for creating Text annotations. +rect+ must be an array
|
26
|
-
# of four numbers, describing the bounds of the annotation. +contents+ should
|
27
|
-
# be a string, to be shown when the annotation is activated.
|
28
|
-
#
|
29
|
-
def text_annotation(rect, contents, options={})
|
30
|
-
options = options.merge(:Subtype => :Text, :Rect => rect, :Contents => contents)
|
31
|
-
annotate(options)
|
32
|
-
end
|
33
|
-
|
34
|
-
# A convenience method for creating Link annotations. +rect+ must be an array
|
35
|
-
# of four numbers, describing the bounds of the annotation. The +options+ hash
|
36
|
-
# should include either :Dest (describing the target destination, usually as a
|
37
|
-
# string that has been recorded in the document's Dests tree), or :A (describing
|
38
|
-
# an action to perform on clicking the link), or :PA (for describing a URL to
|
39
|
-
# link to).
|
40
|
-
#
|
41
|
-
def link_annotation(rect, options={})
|
42
|
-
options = options.merge(:Subtype => :Link, :Rect => rect)
|
43
|
-
annotate(options)
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def sanitize_annotation_hash(options)
|
49
|
-
options = options.merge(:Type => :Annot)
|
50
|
-
|
51
|
-
if options[:Dest].is_a?(String)
|
52
|
-
options[:Dest] = PDF::Core::LiteralString.new(options[:Dest])
|
53
|
-
end
|
54
|
-
|
55
|
-
options
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
data/lib/pdf/core/byte_string.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# Implements destination support for PDF
|
4
|
-
#
|
5
|
-
# Copyright November 2008, Jamis Buck. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
|
-
|
9
|
-
module PDF
|
10
|
-
module Core
|
11
|
-
module Destinations #:nodoc:
|
12
|
-
|
13
|
-
# The maximum number of children to fit into a single node in the Dests tree.
|
14
|
-
NAME_TREE_CHILDREN_LIMIT = 20 #:nodoc:
|
15
|
-
|
16
|
-
# The Dests name tree in the Name dictionary (see Prawn::Document::Internal#names).
|
17
|
-
# This name tree is used to store named destinations (PDF spec 8.2.1).
|
18
|
-
# (For more on name trees, see section 3.8.4 in the PDF spec.)
|
19
|
-
#
|
20
|
-
def dests
|
21
|
-
names.data[:Dests] ||= ref!(PDF::Core::NameTree::Node.new(self, NAME_TREE_CHILDREN_LIMIT))
|
22
|
-
end
|
23
|
-
|
24
|
-
# Adds a new destination to the dests name tree (see #dests). The
|
25
|
-
# +reference+ parameter will be converted into a PDF::Core::Reference if
|
26
|
-
# it is not already one.
|
27
|
-
#
|
28
|
-
def add_dest(name, reference)
|
29
|
-
reference = ref!(reference) unless reference.is_a?(PDF::Core::Reference)
|
30
|
-
dests.data.add(name, reference)
|
31
|
-
end
|
32
|
-
|
33
|
-
# Return a Dest specification for a specific location (and optional zoom
|
34
|
-
# level).
|
35
|
-
#
|
36
|
-
def dest_xyz(left, top, zoom=nil, dest_page=page)
|
37
|
-
[dest_page.dictionary, :XYZ, left, top, zoom]
|
38
|
-
end
|
39
|
-
|
40
|
-
# Return a Dest specification that will fit the given page into the
|
41
|
-
# viewport.
|
42
|
-
#
|
43
|
-
def dest_fit(dest_page=page)
|
44
|
-
[dest_page.dictionary, :Fit]
|
45
|
-
end
|
46
|
-
|
47
|
-
# Return a Dest specification that will fit the given page horizontally
|
48
|
-
# into the viewport, aligned vertically at the given top coordinate.
|
49
|
-
#
|
50
|
-
def dest_fit_horizontally(top, dest_page=page)
|
51
|
-
[dest_page.dictionary, :FitH, top]
|
52
|
-
end
|
53
|
-
|
54
|
-
# Return a Dest specification that will fit the given page vertically
|
55
|
-
# into the viewport, aligned horizontally at the given left coordinate.
|
56
|
-
#
|
57
|
-
def dest_fit_vertically(left, dest_page=page)
|
58
|
-
[dest_page.dictionary, :FitV, left]
|
59
|
-
end
|
60
|
-
|
61
|
-
# Return a Dest specification that will fit the given rectangle into the
|
62
|
-
# viewport, for the given page.
|
63
|
-
#
|
64
|
-
def dest_fit_rect(left, bottom, right, top, dest_page=page)
|
65
|
-
[dest_page.dictionary, :FitR, left, bottom, right, top]
|
66
|
-
end
|
67
|
-
|
68
|
-
# Return a Dest specfication that will fit the given page's bounding box
|
69
|
-
# into the viewport.
|
70
|
-
#
|
71
|
-
def dest_fit_bounds(dest_page=page)
|
72
|
-
[dest_page.dictionary, :FitB]
|
73
|
-
end
|
74
|
-
|
75
|
-
# Same as #dest_fit_horizontally, but works on the page's bounding box
|
76
|
-
# instead of the entire page.
|
77
|
-
#
|
78
|
-
def dest_fit_bounds_horizontally(top, dest_page=page)
|
79
|
-
[dest_page.dictionary, :FitBH, top]
|
80
|
-
end
|
81
|
-
|
82
|
-
# Same as #dest_fit_vertically, but works on the page's bounding box
|
83
|
-
# instead of the entire page.
|
84
|
-
#
|
85
|
-
def dest_fit_bounds_vertically(left, dest_page=page)
|
86
|
-
[dest_page.dictionary, :FitBV, left]
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
module PDF
|
2
|
-
module Core
|
3
|
-
class DocumentState #:nodoc:
|
4
|
-
def initialize(options)
|
5
|
-
normalize_metadata(options)
|
6
|
-
|
7
|
-
if options[:template]
|
8
|
-
@store = PDF::Core::ObjectStore.new(:template => options[:template])
|
9
|
-
@store.info.data.merge!(options[:info]) if options[:info]
|
10
|
-
else
|
11
|
-
@store = PDF::Core::ObjectStore.new(:info => options[:info])
|
12
|
-
end
|
13
|
-
|
14
|
-
@version = 1.3
|
15
|
-
@pages = []
|
16
|
-
@page = nil
|
17
|
-
@trailer = {}
|
18
|
-
@compress = options.fetch(:compress, false)
|
19
|
-
@encrypt = options.fetch(:encrypt, false)
|
20
|
-
@encryption_key = options[:encryption_key]
|
21
|
-
@optimize_objects = options.fetch(:optimize_objects, false)
|
22
|
-
@skip_encoding = options.fetch(:skip_encoding, false)
|
23
|
-
@before_render_callbacks = []
|
24
|
-
@on_page_create_callback = nil
|
25
|
-
end
|
26
|
-
|
27
|
-
attr_accessor :store, :version, :pages, :page, :trailer, :compress,
|
28
|
-
:encrypt, :encryption_key, :optimize_objects, :skip_encoding,
|
29
|
-
:before_render_callbacks, :on_page_create_callback
|
30
|
-
|
31
|
-
def populate_pages_from_store(document)
|
32
|
-
return 0 if @store.page_count <= 0 || @pages.size > 0
|
33
|
-
|
34
|
-
count = (1..@store.page_count)
|
35
|
-
@pages = count.map do |index|
|
36
|
-
orig_dict_id = @store.object_id_for_page(index)
|
37
|
-
PDF::Core::Page.new(document, :object_id => orig_dict_id)
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
def normalize_metadata(options)
|
43
|
-
options[:info] ||= {}
|
44
|
-
options[:info][:Creator] ||= "Prawn"
|
45
|
-
options[:info][:Producer] ||= "Prawn"
|
46
|
-
|
47
|
-
options[:info]
|
48
|
-
end
|
49
|
-
|
50
|
-
def insert_page(page, page_number)
|
51
|
-
pages.insert(page_number, page)
|
52
|
-
store.pages.data[:Kids].insert(page_number, page.dictionary)
|
53
|
-
store.pages.data[:Count] += 1
|
54
|
-
end
|
55
|
-
|
56
|
-
def on_page_create_action(doc)
|
57
|
-
on_page_create_callback[doc] if on_page_create_callback
|
58
|
-
end
|
59
|
-
|
60
|
-
def before_render_actions(doc)
|
61
|
-
before_render_callbacks.each{ |c| c.call(self) }
|
62
|
-
end
|
63
|
-
|
64
|
-
def page_count
|
65
|
-
pages.length
|
66
|
-
end
|
67
|
-
|
68
|
-
def render_body(output)
|
69
|
-
store.compact if optimize_objects
|
70
|
-
store.each do |ref|
|
71
|
-
ref.offset = output.size
|
72
|
-
output << (@encrypt ? ref.encrypted_object(@encryption_key) :
|
73
|
-
ref.object)
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
data/lib/pdf/core/filter_list.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
module PDF
|
2
|
-
module Core
|
3
|
-
class FilterList
|
4
|
-
def initialize
|
5
|
-
@list = []
|
6
|
-
end
|
7
|
-
|
8
|
-
def <<(filter)
|
9
|
-
case filter
|
10
|
-
when Symbol
|
11
|
-
@list << [filter, nil]
|
12
|
-
when ::Hash
|
13
|
-
filter.each do |name, params|
|
14
|
-
@list << [name, params]
|
15
|
-
end
|
16
|
-
else
|
17
|
-
raise "Can not interpret input as filter: #{filter.inspect}"
|
18
|
-
end
|
19
|
-
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
def normalized
|
24
|
-
@list
|
25
|
-
end
|
26
|
-
alias_method :to_a, :normalized
|
27
|
-
|
28
|
-
def names
|
29
|
-
@list.map do |(name, _)|
|
30
|
-
name
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def decode_params
|
35
|
-
@list.map do |(_, params)|
|
36
|
-
params
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def inspect
|
41
|
-
@list.inspect
|
42
|
-
end
|
43
|
-
|
44
|
-
def each(&block)
|
45
|
-
@list.each do |filter|
|
46
|
-
block.call(filter)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/pdf/core/filters.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# prawn/core/filters.rb : Implements stream filters
|
4
|
-
#
|
5
|
-
# Copyright February 2013, Alexander Mankuta. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details.
|
8
|
-
|
9
|
-
require 'zlib'
|
10
|
-
|
11
|
-
module PDF
|
12
|
-
module Core
|
13
|
-
module Filters
|
14
|
-
module FlateDecode
|
15
|
-
def self.encode(stream, params = nil)
|
16
|
-
Zlib::Deflate.deflate(stream)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.decode(stream, params = nil)
|
20
|
-
Zlib::Inflate.inflate(stream)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
# Pass through stub
|
25
|
-
module DCTDecode
|
26
|
-
def self.encode(stream, params = nil)
|
27
|
-
stream
|
28
|
-
end
|
29
|
-
|
30
|
-
def self.decode(stream, params = nil)
|
31
|
-
stream
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Implements graphics state saving and restoring
|
4
|
-
#
|
5
|
-
# Copyright January 2010, Michael Witrant. All Rights Reserved.
|
6
|
-
#
|
7
|
-
# This is free software. Please see the LICENSE and COPYING files for details
|
8
|
-
#
|
9
|
-
|
10
|
-
|
11
|
-
module PDF
|
12
|
-
module Core
|
13
|
-
class GraphicStateStack
|
14
|
-
attr_accessor :stack
|
15
|
-
|
16
|
-
def initialize(previous_state = nil)
|
17
|
-
self.stack = [GraphicState.new(previous_state)]
|
18
|
-
end
|
19
|
-
|
20
|
-
def save_graphic_state(graphic_state = nil)
|
21
|
-
stack.push(GraphicState.new(graphic_state || current_state))
|
22
|
-
end
|
23
|
-
|
24
|
-
def restore_graphic_state
|
25
|
-
if stack.empty?
|
26
|
-
raise PDF::Core::Errors::EmptyGraphicStateStack,
|
27
|
-
"\n You have reached the end of the graphic state stack"
|
28
|
-
end
|
29
|
-
stack.pop
|
30
|
-
end
|
31
|
-
|
32
|
-
def current_state
|
33
|
-
stack.last
|
34
|
-
end
|
35
|
-
|
36
|
-
def present?
|
37
|
-
stack.size > 0
|
38
|
-
end
|
39
|
-
|
40
|
-
def empty?
|
41
|
-
stack.empty?
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
class GraphicState
|
47
|
-
attr_accessor :color_space, :dash, :cap_style, :join_style, :line_width, :fill_color, :stroke_color
|
48
|
-
|
49
|
-
def initialize(previous_state = nil)
|
50
|
-
@color_space = previous_state ? previous_state.color_space.dup : {}
|
51
|
-
@fill_color = previous_state ? previous_state.fill_color : "000000"
|
52
|
-
@stroke_color = previous_state ? previous_state.stroke_color : "000000"
|
53
|
-
@dash = previous_state ? previous_state.dash : { :dash => nil, :space => nil, :phase => 0 }
|
54
|
-
@cap_style = previous_state ? previous_state.cap_style : :butt
|
55
|
-
@join_style = previous_state ? previous_state.join_style : :miter
|
56
|
-
@line_width = previous_state ? previous_state.line_width : 1
|
57
|
-
end
|
58
|
-
|
59
|
-
def dash_setting
|
60
|
-
if @dash[:dash].kind_of?(Array)
|
61
|
-
"[#{@dash[:dash].join(' ')}] #{@dash[:phase]} d"
|
62
|
-
else
|
63
|
-
"[#{@dash[:dash]} #{@dash[:space]}] #{@dash[:phase]} d"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
module PDF
|
3
|
-
module Core
|
4
|
-
# This is used to differentiate strings that must be encoded as
|
5
|
-
# a *literal* string, versus those that can be encoded in
|
6
|
-
# the PDF hexadecimal format.
|
7
|
-
#
|
8
|
-
# Some features of the PDF format appear to require that literal
|
9
|
-
# strings be used. One such feature is the /Dest key of a link
|
10
|
-
# annotation; if a hex encoded string is used there, the links
|
11
|
-
# do not work (as tested in Mac OS X Preview, and Adobe Acrobat
|
12
|
-
# Reader).
|
13
|
-
class LiteralString < String #:nodoc:
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|