prawn 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -2
- data/lib/prawn.rb +5 -3
- data/lib/prawn/document.rb +7 -7
- data/lib/prawn/document/bounding_box.rb +1 -1
- data/lib/prawn/document/column_box.rb +3 -3
- data/lib/prawn/document/internals.rb +1 -1
- data/lib/prawn/font.rb +24 -8
- data/lib/prawn/font/afm.rb +4 -4
- data/lib/prawn/font_metric_cache.rb +1 -1
- data/lib/prawn/grid.rb +3 -1
- data/lib/prawn/image_handler.rb +3 -1
- data/lib/prawn/images/jpg.rb +1 -1
- data/lib/prawn/measurement_extensions.rb +1 -1
- data/lib/prawn/outline.rb +3 -1
- data/lib/prawn/security.rb +1 -1
- data/lib/prawn/security/arcfour.rb +4 -2
- data/lib/prawn/table.rb +14 -2
- data/lib/prawn/table/cell.rb +1 -1
- data/lib/prawn/table/cells.rb +1 -50
- data/lib/prawn/table/column_width_calculator.rb +131 -10
- data/lib/prawn/text.rb +1 -1
- data/lib/prawn/text/formatted.rb +2 -0
- data/lib/prawn/text/formatted/arranger.rb +1 -1
- data/lib/prawn/text/formatted/box.rb +5 -5
- data/lib/prawn/text/formatted/line_wrap.rb +1 -1
- data/lib/prawn/text/formatted/wrap.rb +2 -0
- data/lib/prawn/utilities.rb +3 -3
- data/manual/absolute_position.pdf +0 -0
- data/manual/basic_concepts/adding_pages.rb +3 -3
- data/manual/basic_concepts/basic_concepts.rb +6 -6
- data/manual/basic_concepts/cursor.rb +5 -5
- data/manual/basic_concepts/measurement.rb +2 -2
- data/manual/basic_concepts/origin.rb +3 -3
- data/manual/basic_concepts/other_cursor_helpers.rb +6 -6
- data/manual/bounding_box/bounding_box.rb +6 -6
- data/manual/bounding_box/bounds.rb +6 -6
- data/manual/bounding_box/canvas.rb +2 -2
- data/manual/bounding_box/creation.rb +3 -3
- data/manual/bounding_box/indentation.rb +9 -9
- data/manual/bounding_box/nesting.rb +8 -8
- data/manual/bounding_box/russian_boxes.rb +1 -1
- data/manual/bounding_box/stretchy.rb +8 -8
- data/manual/{manual/manual.rb → contents.rb} +6 -9
- data/manual/{manual/cover.rb → cover.rb} +6 -6
- data/manual/document_and_page_options/background.rb +2 -2
- data/manual/document_and_page_options/document_and_page_options.rb +4 -4
- data/manual/document_and_page_options/metadata.rb +2 -2
- data/manual/document_and_page_options/page_margins.rb +2 -2
- data/manual/document_and_page_options/page_size.rb +3 -3
- data/manual/example_helper.rb +5 -409
- data/manual/graphics/circle_and_ellipse.rb +4 -4
- data/manual/graphics/color.rb +4 -4
- data/manual/graphics/common_lines.rb +5 -5
- data/manual/graphics/fill_and_stroke.rb +5 -5
- data/manual/graphics/fill_rules.rb +1 -1
- data/manual/graphics/gradients.rb +1 -1
- data/manual/graphics/graphics.rb +8 -8
- data/manual/graphics/helper.rb +1 -1
- data/manual/graphics/line_width.rb +5 -5
- data/manual/graphics/lines_and_curves.rb +5 -5
- data/manual/graphics/polygon.rb +4 -4
- data/manual/graphics/rectangle.rb +3 -3
- data/manual/graphics/rotate.rb +5 -5
- data/manual/graphics/scale.rb +5 -5
- data/manual/graphics/soft_masks.rb +1 -1
- data/manual/graphics/stroke_cap.rb +3 -3
- data/manual/graphics/stroke_dash.rb +1 -1
- data/manual/graphics/stroke_join.rb +4 -4
- data/manual/graphics/translate.rb +5 -5
- data/manual/graphics/transparency.rb +5 -5
- data/manual/{manual/how_to_read_this_manual.rb → how_to_read_this_manual.rb} +16 -17
- data/manual/images/absolute_position.rb +3 -3
- data/manual/images/fit.rb +2 -2
- data/manual/images/horizontal.rb +3 -3
- data/manual/images/images.rb +7 -7
- data/manual/images/plain_image.rb +1 -1
- data/manual/images/scale.rb +3 -3
- data/manual/images/vertical.rb +3 -3
- data/manual/images/width_and_height.rb +3 -3
- data/manual/layout/boxes.rb +4 -4
- data/manual/layout/content.rb +3 -3
- data/manual/layout/layout.rb +5 -5
- data/manual/layout/simple_grid.rb +2 -2
- data/manual/outline/add_subsection_to.rb +7 -7
- data/manual/outline/insert_section_after.rb +5 -5
- data/manual/outline/outline.rb +6 -6
- data/manual/outline/sections_and_pages.rb +9 -9
- data/manual/repeatable_content/page_numbering.rb +3 -3
- data/manual/repeatable_content/repeatable_content.rb +5 -5
- data/manual/repeatable_content/repeater.rb +4 -4
- data/manual/repeatable_content/stamp.rb +4 -4
- data/manual/security/encryption.rb +2 -2
- data/manual/security/permissions.rb +2 -2
- data/manual/security/security.rb +5 -5
- data/manual/table/basic_block.rb +5 -5
- data/manual/table/before_rendering_page.rb +1 -1
- data/manual/table/cell_border_lines.rb +4 -4
- data/manual/table/cell_borders_and_bg.rb +4 -4
- data/manual/table/cell_dimensions.rb +3 -3
- data/manual/table/cell_text.rb +6 -6
- data/manual/table/column_widths.rb +4 -4
- data/manual/table/content_and_subtables.rb +5 -5
- data/manual/table/creation.rb +2 -2
- data/manual/table/filtering.rb +6 -6
- data/manual/table/flow_and_header.rb +2 -2
- data/manual/table/image_cells.rb +1 -1
- data/manual/table/position.rb +1 -1
- data/manual/table/row_colors.rb +3 -3
- data/manual/table/span.rb +1 -1
- data/manual/table/style.rb +3 -3
- data/manual/table/table.rb +7 -7
- data/manual/table/width.rb +3 -3
- data/manual/text/alignment.rb +1 -1
- data/manual/text/color.rb +1 -1
- data/manual/text/column_box.rb +1 -1
- data/manual/text/fallback_fonts.rb +3 -3
- data/manual/text/font.rb +7 -7
- data/manual/text/font_size.rb +9 -9
- data/manual/text/font_style.rb +3 -3
- data/manual/text/formatted_callbacks.rb +3 -3
- data/manual/text/formatted_text.rb +3 -3
- data/manual/text/free_flowing_text.rb +6 -6
- data/manual/text/inline.rb +5 -5
- data/manual/text/kerning_and_character_spacing.rb +7 -7
- data/manual/text/leading.rb +4 -4
- data/manual/text/line_wrapping.rb +4 -4
- data/manual/text/paragraph_indentation.rb +3 -3
- data/manual/text/positioned_text.rb +3 -3
- data/manual/text/registering_families.rb +6 -6
- data/manual/text/rendering_and_color.rb +2 -2
- data/manual/text/right_to_left_text.rb +2 -2
- data/manual/text/rotation.rb +4 -4
- data/manual/text/single_usage.rb +3 -3
- data/manual/text/text.rb +9 -9
- data/manual/text/text_box_excess.rb +2 -2
- data/manual/text/text_box_extensions.rb +3 -3
- data/manual/text/text_box_overflow.rb +4 -4
- data/manual/text/utf8.rb +5 -5
- data/manual/text/win_ansi_charset.rb +1 -1
- data/prawn.gemspec +5 -3
- data/spec/acceptance/png.rb +5 -3
- data/spec/cell_spec.rb +1 -0
- data/spec/column_box_spec.rb +1 -1
- data/spec/extensions/encoding_helpers.rb +2 -0
- data/spec/extensions/mocha.rb +2 -0
- data/spec/font_spec.rb +15 -0
- data/spec/measurement_units_spec.rb +2 -0
- data/spec/repeater_spec.rb +2 -0
- data/spec/soft_mask_spec.rb +2 -0
- data/spec/stamp_spec.rb +2 -0
- data/spec/table_spec.rb +103 -10
- data/spec/text_spec.rb +1 -1
- data/spec/transparency_spec.rb +2 -0
- metadata +42 -18
- data/lib/prawn/layout.rb +0 -17
- data/manual/example_file.rb +0 -111
- data/manual/example_package.rb +0 -53
- data/manual/example_section.rb +0 -46
- data/manual/syntax_highlight.rb +0 -52
@@ -13,11 +13,11 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
13
13
|
%w[.. example_helper]))
|
14
14
|
|
15
15
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
16
|
-
Prawn::Example.generate(filename) do
|
16
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
17
17
|
y_position = cursor
|
18
18
|
text "The image won't go below this line of text."
|
19
|
-
|
19
|
+
|
20
20
|
image "#{Prawn::DATADIR}/images/fractal.jpg", :at => [200, y_position]
|
21
|
-
|
21
|
+
|
22
22
|
text "And this line of text will go just below the previous one."
|
23
23
|
end
|
data/manual/images/fit.rb
CHANGED
@@ -10,9 +10,9 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
10
10
|
%w[.. example_helper]))
|
11
11
|
|
12
12
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
13
|
-
Prawn::Example.generate(filename) do
|
13
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
14
14
|
size = 300
|
15
|
-
|
15
|
+
|
16
16
|
text "Using the fit option"
|
17
17
|
bounding_box([0, cursor], :width => size, :height => size) do
|
18
18
|
image "#{Prawn::DATADIR}/images/pigs.jpg", :fit => [size, size]
|
data/manual/images/horizontal.rb
CHANGED
@@ -10,15 +10,15 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
10
10
|
%w[.. example_helper]))
|
11
11
|
|
12
12
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
13
|
-
Prawn::Example.generate(filename) do
|
13
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
14
14
|
bounding_box([50, cursor], :width => 400, :height => 450) do
|
15
15
|
stroke_bounds
|
16
|
-
|
16
|
+
|
17
17
|
[:left, :center, :right].each do |position|
|
18
18
|
text "Image aligned to the #{position}."
|
19
19
|
image "#{Prawn::DATADIR}/images/stef.jpg", :position => position
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
text "The next image has a 50 point offset from the left boundary"
|
23
23
|
image "#{Prawn::DATADIR}/images/stef.jpg", :position => 50
|
24
24
|
end
|
data/manual/images/images.rb
CHANGED
@@ -5,26 +5,26 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
|
-
Prawn::Example.generate("images.pdf", :page_size => "FOLIO") do
|
9
|
-
|
8
|
+
Prawn::ManualBuilder::Example.generate("images.pdf", :page_size => "FOLIO") do
|
9
|
+
|
10
10
|
package "images" do |p|
|
11
|
-
|
11
|
+
|
12
12
|
p.section "Basics" do |s|
|
13
13
|
s.example "plain_image"
|
14
14
|
s.example "absolute_position"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
p.section "Relative Positioning" do |s|
|
18
18
|
s.example "horizontal"
|
19
19
|
s.example "vertical"
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
p.section "Size" do |s|
|
23
23
|
s.example "width_and_height"
|
24
24
|
s.example "scale"
|
25
25
|
s.example "fit"
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
p.intro do
|
29
29
|
prose("Embedding images on PDF documents is fairly easy. Prawn supports both JPG and PNG images.
|
30
30
|
|
@@ -35,6 +35,6 @@ Prawn::Example.generate("images.pdf", :page_size => "FOLIO") do
|
|
35
35
|
"How to configure the image dimensions by setting the width and height or by scaling it"
|
36
36
|
)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
end
|
40
40
|
end
|
@@ -12,7 +12,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
12
12
|
%w[.. example_helper]))
|
13
13
|
|
14
14
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
15
|
-
Prawn::Example.generate(filename) do
|
15
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
16
16
|
text "The image will go right below this line of text."
|
17
17
|
image "#{Prawn::DATADIR}/images/pigs.jpg"
|
18
18
|
end
|
data/manual/images/scale.rb
CHANGED
@@ -8,15 +8,15 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
8
8
|
%w[.. example_helper]))
|
9
9
|
|
10
10
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
11
|
-
Prawn::Example.generate(filename) do
|
11
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
12
12
|
text "Normal size"
|
13
13
|
image "#{Prawn::DATADIR}/images/stef.jpg"
|
14
14
|
move_down 20
|
15
|
-
|
15
|
+
|
16
16
|
text "Scaled to 50%"
|
17
17
|
image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 0.5
|
18
18
|
move_down 20
|
19
|
-
|
19
|
+
|
20
20
|
text "Scaled to 200%"
|
21
21
|
image "#{Prawn::DATADIR}/images/stef.jpg", :scale => 2
|
22
22
|
end
|
data/manual/images/vertical.rb
CHANGED
@@ -10,16 +10,16 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
10
10
|
%w[.. example_helper]))
|
11
11
|
|
12
12
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
13
|
-
Prawn::Example.generate(filename) do
|
13
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
14
14
|
bounding_box([0, cursor], :width => 500, :height => 450) do
|
15
15
|
stroke_bounds
|
16
|
-
|
16
|
+
|
17
17
|
[:top, :center, :bottom].each do |vposition|
|
18
18
|
text "Image vertically aligned to the #{vposition}.", :valign => vposition
|
19
19
|
image "#{Prawn::DATADIR}/images/stef.jpg", :position => 250,
|
20
20
|
:vposition => vposition
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
text_box "The next image has a 100 point offset from the top boundary",
|
24
24
|
:at => [bounds.width - 110, bounds.top - 10], :width => 100
|
25
25
|
image "#{Prawn::DATADIR}/images/stef.jpg", :position => :right,
|
@@ -11,15 +11,15 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
11
11
|
%w[.. example_helper]))
|
12
12
|
|
13
13
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
14
|
-
Prawn::Example.generate(filename) do
|
14
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
15
15
|
text "Scale by setting only the width"
|
16
16
|
image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 150
|
17
17
|
move_down 20
|
18
|
-
|
18
|
+
|
19
19
|
text "Scale by setting only the height"
|
20
20
|
image "#{Prawn::DATADIR}/images/pigs.jpg", :height => 100
|
21
21
|
move_down 20
|
22
|
-
|
22
|
+
|
23
23
|
text "Stretch to fit the width and height provided"
|
24
24
|
image "#{Prawn::DATADIR}/images/pigs.jpg", :width => 500, :height => 100
|
25
25
|
end
|
data/manual/layout/boxes.rb
CHANGED
@@ -12,16 +12,16 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
12
12
|
%w[.. example_helper]))
|
13
13
|
|
14
14
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
15
|
-
Prawn::Example.generate(filename) do
|
15
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
16
16
|
# The grid only need to be defined once, but since all the examples should be
|
17
17
|
# able to run alone we are repeating it on every example
|
18
18
|
define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
19
|
-
|
19
|
+
|
20
20
|
grid(4,0).show
|
21
21
|
grid(5,1).show
|
22
|
-
|
22
|
+
|
23
23
|
grid([6,2], [7,3]).show
|
24
|
-
|
24
|
+
|
25
25
|
grid([4,4], [7,4]).show
|
26
26
|
grid([7,0], [7,1]).show
|
27
27
|
end
|
data/manual/layout/content.rb
CHANGED
@@ -10,15 +10,15 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
10
10
|
%w[.. example_helper]))
|
11
11
|
|
12
12
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
13
|
-
Prawn::Example.generate(filename) do
|
13
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
14
14
|
# The grid only need to be defined once, but since all the examples should be
|
15
15
|
# able to run alone we are repeating it on every example
|
16
16
|
define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
17
|
-
|
17
|
+
|
18
18
|
grid([5,0], [7,1]).bounding_box do
|
19
19
|
text "Adding some content to this multi_box.\n" + " _ " * 200
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
grid(6,3).bounding_box do
|
23
23
|
text "Just a little snippet here.\n" + " _ " * 10
|
24
24
|
end
|
data/manual/layout/layout.rb
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
|
-
Prawn::Example.generate("layout.pdf", :page_size => "FOLIO") do
|
9
|
-
|
8
|
+
Prawn::ManualBuilder::Example.generate("layout.pdf", :page_size => "FOLIO") do
|
9
|
+
|
10
10
|
package "layout" do |p|
|
11
|
-
|
11
|
+
|
12
12
|
p.example "simple_grid"
|
13
13
|
p.example "boxes"
|
14
14
|
p.example "content"
|
15
|
-
|
15
|
+
|
16
16
|
p.intro do
|
17
17
|
prose("Prawn has support for two-dimensional grid based layouts out of the box.
|
18
18
|
|
@@ -23,6 +23,6 @@ Prawn::Example.generate("layout.pdf", :page_size => "FOLIO") do
|
|
23
23
|
"How to create boxes according to the grid"
|
24
24
|
)
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
end
|
28
28
|
end
|
@@ -12,12 +12,12 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
12
12
|
%w[.. example_helper]))
|
13
13
|
|
14
14
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
15
|
-
Prawn::Example.generate(filename) do
|
15
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
16
16
|
# The grid only need to be defined once, but since all the examples should be
|
17
17
|
# able to run alone we are repeating it on every example
|
18
18
|
define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
19
19
|
text "We defined the grid, roll over to the next page to see its outline"
|
20
|
-
|
20
|
+
|
21
21
|
start_new_page
|
22
22
|
grid.show_all
|
23
23
|
end
|
@@ -21,20 +21,20 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
21
21
|
%w[.. example_helper]))
|
22
22
|
|
23
23
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
24
|
-
Prawn::Example.generate(filename) do
|
24
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
25
25
|
# First we create 10 pages and some default outline
|
26
26
|
(1..10).each do |index|
|
27
27
|
text "Page #{index}"
|
28
28
|
start_new_page
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
outline.define do
|
32
|
-
section("Section 1", :destination => 1) do
|
32
|
+
section("Section 1", :destination => 1) do
|
33
33
|
page :title => "Page 2", :destination => 2
|
34
34
|
page :title => "Page 3", :destination => 3
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# Now we will start adding nodes to the previous outline
|
39
39
|
outline.add_subsection_to("Section 1", :first) do
|
40
40
|
outline.section("Added later - first position") do
|
@@ -42,17 +42,17 @@ Prawn::Example.generate(filename) do
|
|
42
42
|
outline.page :title => "Page 5", :destination => 5
|
43
43
|
end
|
44
44
|
end
|
45
|
-
|
45
|
+
|
46
46
|
outline.add_subsection_to("Section 1") do
|
47
47
|
outline.page :title => "Added later - last position",
|
48
48
|
:destination => 6
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
outline.add_subsection_to("Added later - first position") do
|
52
52
|
outline.page :title => "Another page added later",
|
53
53
|
:destination => 7
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
# The title provided is for a page which will be converted into a section
|
57
57
|
outline.add_subsection_to("Page 3") do
|
58
58
|
outline.page :title => "Last page added",
|
@@ -13,20 +13,20 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
13
13
|
%w[.. example_helper]))
|
14
14
|
|
15
15
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
16
|
-
Prawn::Example.generate(filename) do
|
16
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
17
17
|
# First we create 10 pages and some default outline
|
18
18
|
(1..10).each do |index|
|
19
19
|
text "Page #{index}"
|
20
20
|
start_new_page
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
outline.define do
|
24
|
-
section("Section 1", :destination => 1) do
|
24
|
+
section("Section 1", :destination => 1) do
|
25
25
|
page :title => "Page 2", :destination => 2
|
26
26
|
page :title => "Page 3", :destination => 3
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
# Now we will start adding nodes to the previous outline
|
31
31
|
outline.insert_section_after("Page 2") do
|
32
32
|
outline.section("Section after Page 2") do
|
@@ -39,7 +39,7 @@ Prawn::Example.generate(filename) do
|
|
39
39
|
outline.page :title => "Page 5", :destination => 5
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
# Adding just a page
|
44
44
|
outline.insert_section_after("Page 3") do
|
45
45
|
outline.page :title => "Page after Page 3", :destination => 6
|
data/manual/outline/outline.rb
CHANGED
@@ -5,19 +5,19 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
|
-
Prawn::Example.generate("outline.pdf", :page_size => "FOLIO") do
|
9
|
-
|
8
|
+
Prawn::ManualBuilder::Example.generate("outline.pdf", :page_size => "FOLIO") do
|
9
|
+
|
10
10
|
package "outline" do |p|
|
11
|
-
|
11
|
+
|
12
12
|
p.section "Basics" do |s|
|
13
13
|
s.example "sections_and_pages", :eval_source => false
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
p.section "Adding nodes later" do |s|
|
17
17
|
s.example "add_subsection_to", :eval_source => false
|
18
18
|
s.example "insert_section_after", :eval_source => false
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
p.intro do
|
22
22
|
prose("The outline of a PDF document is the table of contents tab you see to the right or left of your PDF viewer.
|
23
23
|
|
@@ -27,6 +27,6 @@ Prawn::Example.generate("outline.pdf", :page_size => "FOLIO") do
|
|
27
27
|
"How to insert sections and/or pages to a previously defined outline structure"
|
28
28
|
)
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
end
|
32
32
|
end
|
@@ -28,39 +28,39 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
28
28
|
%w[.. example_helper]))
|
29
29
|
|
30
30
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
31
|
-
Prawn::Example.generate(filename) do
|
31
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
32
32
|
# First we create 10 pages just to have something to link to
|
33
33
|
(1..10).each do |index|
|
34
34
|
text "Page #{index}"
|
35
35
|
start_new_page
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
outline.define do
|
39
|
-
section("Section 1", :destination => 1) do
|
39
|
+
section("Section 1", :destination => 1) do
|
40
40
|
page :title => "Page 2", :destination => 2
|
41
41
|
page :title => "Page 3", :destination => 3
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
section("Section 2", :destination => 4) do
|
45
45
|
page :title => "Page 5", :destination => 5
|
46
|
-
|
46
|
+
|
47
47
|
section("Subsection 2.1", :destination => 6, :closed => true) do
|
48
48
|
page :title => "Page 7", :destination => 7
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# Outside of the define block
|
54
54
|
outline.section("Section 3", :destination => 8) do
|
55
55
|
outline.page :title => "Page 9", :destination => 9
|
56
56
|
end
|
57
|
-
|
57
|
+
|
58
58
|
outline.page :title => "Page 10", :destination => 10
|
59
|
-
|
59
|
+
|
60
60
|
# Section and Pages without links. While a section without a link may be
|
61
61
|
# useful to group some pages, a page without a link is useless
|
62
62
|
outline.update do # update is an alias to define
|
63
|
-
section("Section without link") do
|
63
|
+
section("Section without link") do
|
64
64
|
page :title => "Page without link"
|
65
65
|
end
|
66
66
|
end
|
@@ -25,9 +25,9 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
25
25
|
%w[.. example_helper]))
|
26
26
|
|
27
27
|
filename = File.basename(__FILE__).gsub('.rb', '.pdf')
|
28
|
-
Prawn::Example.generate(filename) do
|
28
|
+
Prawn::ManualBuilder::Example.generate(filename) do
|
29
29
|
text "This is the first page!"
|
30
|
-
|
30
|
+
|
31
31
|
10.times do
|
32
32
|
start_new_page
|
33
33
|
text "Here comes yet another page."
|
@@ -48,7 +48,7 @@ Prawn::Example.generate(filename) do
|
|
48
48
|
options[:start_count_at] = 8
|
49
49
|
options[:color] = "333333"
|
50
50
|
number_pages string, options
|
51
|
-
|
51
|
+
|
52
52
|
start_new_page
|
53
53
|
text "See. This page isn't numbered and doesn't count towards the total."
|
54
54
|
end
|
@@ -5,14 +5,14 @@
|
|
5
5
|
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
|
-
Prawn::Example.generate("repeatable_content.pdf", :page_size => "FOLIO") do
|
9
|
-
|
8
|
+
Prawn::ManualBuilder::Example.generate("repeatable_content.pdf", :page_size => "FOLIO") do
|
9
|
+
|
10
10
|
package "repeatable_content" do |p|
|
11
|
-
|
11
|
+
|
12
12
|
p.example "repeater", :eval_source => false
|
13
13
|
p.example "stamp"
|
14
14
|
p.example "page_numbering", :eval_source => false
|
15
|
-
|
15
|
+
|
16
16
|
p.intro do
|
17
17
|
prose("Prawn offers two ways to handle repeatable content blocks. Repeater is useful for content that gets repeated at well defined intervals while Stamp is more appropriate if you need better control of when to repeat it.
|
18
18
|
|
@@ -26,6 +26,6 @@ Prawn::Example.generate("repeatable_content.pdf", :page_size => "FOLIO") do
|
|
26
26
|
"How to number the document pages with one simple call"
|
27
27
|
)
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
end
|
31
31
|
end
|