prawn 2.0.1 → 2.0.2
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 +4 -4
- data/Rakefile +7 -5
- data/lib/prawn.rb +4 -4
- data/lib/prawn/document.rb +47 -46
- data/lib/prawn/document/bounding_box.rb +13 -19
- data/lib/prawn/document/column_box.rb +3 -5
- data/lib/prawn/document/internals.rb +0 -1
- data/lib/prawn/document/span.rb +12 -12
- data/lib/prawn/errors.rb +32 -33
- data/lib/prawn/font.rb +29 -36
- data/lib/prawn/font/afm.rb +20 -20
- data/lib/prawn/font/dfont.rb +0 -1
- data/lib/prawn/font/ttf.rb +30 -27
- data/lib/prawn/font_metric_cache.rb +4 -8
- data/lib/prawn/graphics.rb +37 -42
- data/lib/prawn/graphics/cap_style.rb +1 -1
- data/lib/prawn/graphics/color.rb +21 -23
- data/lib/prawn/graphics/dash.rb +5 -6
- data/lib/prawn/graphics/join_style.rb +1 -2
- data/lib/prawn/graphics/patterns.rb +25 -21
- data/lib/prawn/graphics/transformation.rb +4 -5
- data/lib/prawn/graphics/transparency.rb +6 -8
- data/lib/prawn/grid.rb +21 -14
- data/lib/prawn/image_handler.rb +2 -2
- data/lib/prawn/images.rb +29 -31
- data/lib/prawn/images/image.rb +1 -1
- data/lib/prawn/images/jpg.rb +10 -12
- data/lib/prawn/images/png.rb +13 -13
- data/lib/prawn/measurements.rb +7 -14
- data/lib/prawn/outline.rb +6 -6
- data/lib/prawn/repeater.rb +1 -5
- data/lib/prawn/security.rb +17 -25
- data/lib/prawn/security/arcfour.rb +1 -1
- data/lib/prawn/soft_mask.rb +11 -12
- data/lib/prawn/stamp.rb +16 -8
- data/lib/prawn/text.rb +23 -20
- data/lib/prawn/text/box.rb +3 -6
- data/lib/prawn/text/formatted/arranger.rb +9 -12
- data/lib/prawn/text/formatted/box.rb +23 -22
- data/lib/prawn/text/formatted/fragment.rb +0 -4
- data/lib/prawn/text/formatted/line_wrap.rb +13 -24
- data/lib/prawn/text/formatted/parser.rb +16 -20
- data/lib/prawn/text/formatted/wrap.rb +2 -7
- data/lib/prawn/utilities.rb +6 -3
- data/lib/prawn/version.rb +1 -1
- data/manual/basic_concepts/basic_concepts.rb +0 -2
- data/manual/basic_concepts/view.rb +1 -1
- data/manual/bounding_box/bounding_box.rb +0 -3
- data/manual/bounding_box/russian_boxes.rb +7 -8
- data/manual/bounding_box/stretchy.rb +0 -1
- data/manual/contents.rb +2 -2
- data/manual/cover.rb +11 -12
- data/manual/document_and_page_options/document_and_page_options.rb +2 -5
- data/manual/document_and_page_options/metadata.rb +10 -10
- data/manual/document_and_page_options/page_size.rb +0 -1
- data/manual/graphics/fill_rules.rb +5 -4
- data/manual/graphics/graphics.rb +0 -3
- data/manual/graphics/lines_and_curves.rb +1 -1
- data/manual/graphics/rotate.rb +0 -2
- data/manual/graphics/scale.rb +4 -2
- data/manual/graphics/soft_masks.rb +0 -1
- data/manual/graphics/stroke_cap.rb +1 -1
- data/manual/graphics/stroke_join.rb +1 -1
- data/manual/graphics/translate.rb +3 -3
- data/manual/graphics/transparency.rb +0 -1
- data/manual/how_to_read_this_manual.rb +0 -1
- data/manual/images/images.rb +0 -3
- data/manual/layout/boxes.rb +5 -5
- data/manual/layout/content.rb +2 -2
- data/manual/layout/layout.rb +0 -3
- data/manual/outline/outline.rb +0 -3
- data/manual/repeatable_content/page_numbering.rb +1 -1
- data/manual/repeatable_content/repeatable_content.rb +0 -3
- data/manual/repeatable_content/repeater.rb +6 -6
- data/manual/security/encryption.rb +0 -2
- data/manual/security/permissions.rb +0 -2
- data/manual/security/security.rb +0 -3
- data/manual/text/alignment.rb +3 -3
- data/manual/text/color.rb +0 -1
- data/manual/text/column_box.rb +0 -1
- data/manual/text/fallback_fonts.rb +2 -2
- data/manual/text/formatted_callbacks.rb +3 -2
- data/manual/text/paragraph_indentation.rb +2 -3
- data/manual/text/registering_families.rb +13 -9
- data/manual/text/rotation.rb +0 -1
- data/manual/text/text.rb +0 -3
- data/manual/text/text_box_overflow.rb +7 -5
- data/manual/text/utf8.rb +1 -1
- data/manual/text/win_ansi_charset.rb +2 -2
- data/prawn.gemspec +4 -4
- data/spec/acceptance/png.rb +6 -7
- data/spec/annotations_spec.rb +21 -28
- data/spec/bounding_box_spec.rb +100 -109
- data/spec/column_box_spec.rb +26 -32
- data/spec/destinations_spec.rb +2 -4
- data/spec/document_spec.rb +145 -151
- data/spec/extensions/mocha.rb +0 -1
- data/spec/font_metric_cache_spec.rb +7 -7
- data/spec/font_spec.rb +103 -102
- data/spec/formatted_text_arranger_spec.rb +76 -74
- data/spec/formatted_text_box_spec.rb +170 -159
- data/spec/formatted_text_fragment_spec.rb +57 -56
- data/spec/graphics_spec.rb +158 -175
- data/spec/grid_spec.rb +28 -29
- data/spec/image_handler_spec.rb +4 -5
- data/spec/images_spec.rb +50 -36
- data/spec/inline_formatted_text_parser_spec.rb +397 -393
- data/spec/jpg_spec.rb +4 -6
- data/spec/line_wrap_spec.rb +54 -55
- data/spec/measurement_units_spec.rb +12 -15
- data/spec/outline_spec.rb +77 -98
- data/spec/png_spec.rb +55 -65
- data/spec/reference_spec.rb +3 -3
- data/spec/repeater_spec.rb +20 -26
- data/spec/security_spec.rb +42 -49
- data/spec/soft_mask_spec.rb +4 -5
- data/spec/span_spec.rb +5 -6
- data/spec/spec_helper.rb +2 -4
- data/spec/stamp_spec.rb +41 -22
- data/spec/stroke_styles_spec.rb +36 -39
- data/spec/text_at_spec.rb +28 -29
- data/spec/text_box_spec.rb +160 -165
- data/spec/text_rendering_mode_spec.rb +9 -9
- data/spec/text_spacing_spec.rb +13 -13
- data/spec/text_spec.rb +116 -124
- data/spec/text_with_inline_formatting_spec.rb +5 -5
- data/spec/transparency_spec.rb +20 -20
- data/spec/view_spec.rb +0 -1
- metadata +7 -7
@@ -6,9 +6,7 @@
|
|
6
6
|
require_relative "../example_helper"
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("basic_concepts.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "basic_concepts" do |p|
|
11
|
-
|
12
10
|
p.example "creation", :eval_source => false, :full_source => true
|
13
11
|
p.example "origin"
|
14
12
|
p.example "cursor"
|
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("bounding_box.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "bounding_box" do |p|
|
11
|
-
|
12
10
|
p.section "Basics" do |s|
|
13
11
|
s.example "creation"
|
14
12
|
s.example "bounds"
|
@@ -34,6 +32,5 @@ Prawn::ManualBuilder::Example.generate("bounding_box.pdf", :page_size => "FOLIO"
|
|
34
32
|
"Indent blocks"
|
35
33
|
)
|
36
34
|
end
|
37
|
-
|
38
35
|
end
|
39
36
|
end
|
@@ -13,21 +13,21 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
13
13
|
output = []
|
14
14
|
a1.each do |i1|
|
15
15
|
a2.each do |i2|
|
16
|
-
output += [[i1,i2]]
|
16
|
+
output += [[i1, i2]]
|
17
17
|
end
|
18
18
|
end
|
19
19
|
output
|
20
20
|
end
|
21
21
|
|
22
|
-
def recurse_bounding_box(max_depth=4, depth=1)
|
23
|
-
width = (bounds.width-15)/2
|
24
|
-
height = (bounds.height-15)/2
|
25
|
-
left_top_corners = combine([5, bounds.right-width-5],
|
26
|
-
[bounds.top-5, height+5])
|
22
|
+
def recurse_bounding_box(max_depth = 4, depth = 1)
|
23
|
+
width = (bounds.width - 15) / 2
|
24
|
+
height = (bounds.height - 15) / 2
|
25
|
+
left_top_corners = combine([5, bounds.right - width - 5],
|
26
|
+
[bounds.top - 5, height + 5])
|
27
27
|
left_top_corners.each do |lt|
|
28
28
|
bounding_box(lt, :width => width, :height => height) do
|
29
29
|
stroke_bounds
|
30
|
-
recurse_bounding_box(max_depth, depth+1) if depth < max_depth
|
30
|
+
recurse_bounding_box(max_depth, depth + 1) if depth < max_depth
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -37,4 +37,3 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
37
37
|
recurse_bounding_box
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
data/manual/contents.rb
CHANGED
@@ -7,8 +7,8 @@ require_relative "example_helper"
|
|
7
7
|
Encoding.default_external = Encoding::UTF_8
|
8
8
|
|
9
9
|
Prawn::ManualBuilder::Example.generate("manual.pdf",
|
10
|
-
|
11
|
-
|
10
|
+
:skip_page_creation => true,
|
11
|
+
:page_size => "FOLIO") do
|
12
12
|
load_page "", "cover"
|
13
13
|
load_page "", "how_to_read_this_manual"
|
14
14
|
|
data/manual/cover.rb
CHANGED
@@ -13,14 +13,14 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
13
13
|
:scale => 0.9,
|
14
14
|
:at => [10, cursor]
|
15
15
|
|
16
|
-
formatted_text_box([ {:text => "Prawn\n",
|
17
|
-
|
18
|
-
|
16
|
+
formatted_text_box([ { :text => "Prawn\n",
|
17
|
+
:styles => [:bold],
|
18
|
+
:size => 100 }
|
19
19
|
], :at => [170, cursor - 50])
|
20
20
|
|
21
|
-
formatted_text_box([ {:text => "by example",
|
22
|
-
|
23
|
-
|
21
|
+
formatted_text_box([ { :text => "by example",
|
22
|
+
:font => 'Courier',
|
23
|
+
:size => 60 }
|
24
24
|
], :at => [170, cursor - 160])
|
25
25
|
|
26
26
|
if Dir.exist?("#{Prawn::BASEDIR}/.git")
|
@@ -30,10 +30,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
30
30
|
git_commit = ""
|
31
31
|
end
|
32
32
|
|
33
|
-
formatted_text_box([ {:text => "Last Update: #{Time.now.strftime("%Y-%m-%d")}\n"+
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
formatted_text_box([ { :text => "Last Update: #{Time.now.strftime("%Y-%m-%d")}\n" +
|
34
|
+
"Prawn Version: #{Prawn::VERSION}\n" +
|
35
|
+
git_commit,
|
36
|
+
:size => 12 }
|
37
|
+
], :at => [390, cursor - 620])
|
39
38
|
end
|
@@ -6,15 +6,13 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("document_and_page_options.pdf",
|
9
|
-
|
10
|
-
|
9
|
+
:page_size => "FOLIO") do
|
11
10
|
package "document_and_page_options" do |p|
|
12
|
-
|
13
11
|
p.example "page_size", :eval_source => false, :full_source => true
|
14
12
|
p.example "page_margins", :eval_source => false, :full_source => true
|
15
13
|
p.example "background", :eval_source => false, :full_source => true
|
16
14
|
p.example "metadata", :eval_source => false, :full_source => true
|
17
|
-
p.example "print_scaling"
|
15
|
+
p.example "print_scaling", :eval_source => false, :full_source => true
|
18
16
|
|
19
17
|
p.intro do
|
20
18
|
prose("So far we've already seen how to create new documents and start new pages. This chapter expands on the previous examples by showing other options avialable. Some of the options are only available when creating new documents.
|
@@ -27,6 +25,5 @@ Prawn::ManualBuilder::Example.generate("document_and_page_options.pdf",
|
|
27
25
|
"How to add metadata to the generated PDF"
|
28
26
|
)
|
29
27
|
end
|
30
|
-
|
31
28
|
end
|
32
29
|
end
|
@@ -7,17 +7,17 @@
|
|
7
7
|
require File.expand_path(File.join(File.dirname(__FILE__),
|
8
8
|
%w[.. example_helper]))
|
9
9
|
|
10
|
-
|
11
|
-
:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
}) do
|
10
|
+
info = {
|
11
|
+
:Title => "My title",
|
12
|
+
:Author => "John Doe",
|
13
|
+
:Subject => "My Subject",
|
14
|
+
:Keywords => "test metadata ruby pdf dry",
|
15
|
+
:Creator => "ACME Soft App",
|
16
|
+
:Producer => "Prawn",
|
17
|
+
:CreationDate => Time.now
|
18
|
+
}
|
20
19
|
|
20
|
+
Prawn::Document.generate("metadata.pdf", :info => info) do
|
21
21
|
text "This is a test of setting metadata properties via the info option."
|
22
22
|
text "While the keys are arbitrary, the above example sets common attributes."
|
23
23
|
end
|
@@ -26,12 +26,13 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
26
26
|
stroke_color 'ff0000'
|
27
27
|
line_width 2
|
28
28
|
|
29
|
-
text_box "Nonzero Winding Number", :at => [50, 215],
|
30
|
-
|
31
|
-
|
29
|
+
text_box "Nonzero Winding Number", :at => [50, 215],
|
30
|
+
:width => 170,
|
31
|
+
:align => :center
|
32
|
+
polygon(*pentagram.map { |x, y| [x + 50, y] })
|
32
33
|
fill_and_stroke
|
33
34
|
|
34
35
|
text_box "Even-Odd", :at => [330, 215], :width => 170, :align => :center
|
35
|
-
polygon(*pentagram.map { |x, y| [x+330, y] })
|
36
|
+
polygon(*pentagram.map { |x, y| [x + 330, y] })
|
36
37
|
fill_and_stroke(:fill_rule => :even_odd)
|
37
38
|
end
|
data/manual/graphics/graphics.rb
CHANGED
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("graphics.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "graphics" do |p|
|
11
|
-
|
12
10
|
p.section "Basics" do |s|
|
13
11
|
s.example "helper"
|
14
12
|
s.example "fill_and_stroke"
|
@@ -53,6 +51,5 @@ Prawn::ManualBuilder::Example.generate("graphics.pdf", :page_size => "FOLIO") do
|
|
53
51
|
"How to apply transformations to your drawing space"
|
54
52
|
)
|
55
53
|
end
|
56
|
-
|
57
54
|
end
|
58
55
|
end
|
data/manual/graphics/rotate.rb
CHANGED
@@ -18,9 +18,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
18
18
|
fill_circle [250, 200], 2
|
19
19
|
|
20
20
|
12.times do |i|
|
21
|
-
|
22
21
|
rotate(i * 30, :origin => [250, 200]) do
|
23
|
-
|
24
22
|
stroke_rectangle [350, 225], 100, 50
|
25
23
|
draw_text "Rotated #{i * 30}°", :size => 10, :at => [360, 205]
|
26
24
|
end
|
data/manual/graphics/scale.rb
CHANGED
@@ -25,7 +25,8 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
25
25
|
scale(2, :origin => [x, y]) do
|
26
26
|
stroke_rectangle [x, y], width, height
|
27
27
|
text_box "rectangle scaled from upper-left corner",
|
28
|
-
|
28
|
+
:at => [x, y - height - 5],
|
29
|
+
:width => width
|
29
30
|
end
|
30
31
|
|
31
32
|
x = 350
|
@@ -36,6 +37,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
36
37
|
scale(2, :origin => [x + width / 2, y - height / 2]) do
|
37
38
|
stroke_rectangle [x, y], width, height
|
38
39
|
text_box "rectangle scaled from center",
|
39
|
-
|
40
|
+
:at => [x, y - height - 5],
|
41
|
+
:width => width
|
40
42
|
end
|
41
43
|
end
|
@@ -24,7 +24,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
24
24
|
[:butt, :round, :projecting_square].each_with_index do |cap, i|
|
25
25
|
self.cap_style = cap
|
26
26
|
|
27
|
-
y = 250 - i*100
|
27
|
+
y = 250 - i * 100
|
28
28
|
stroke_horizontal_line 100, 300, :at => y
|
29
29
|
stroke_circle [400, y], 15
|
30
30
|
end
|
@@ -11,11 +11,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
11
11
|
stroke_axis
|
12
12
|
|
13
13
|
1.upto(3) do |i|
|
14
|
-
|
15
14
|
x = i * 50
|
16
15
|
y = i * 100
|
17
16
|
translate(x, y) do
|
18
|
-
|
19
17
|
# Draw a point on the new origin
|
20
18
|
fill_circle [0, 0], 2
|
21
19
|
draw_text "New origin after translation to [#{x}, #{y}]",
|
@@ -23,7 +21,9 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
23
21
|
|
24
22
|
stroke_rectangle [100, 75], 100, 50
|
25
23
|
text_box "Top left corner at [100,75]",
|
26
|
-
|
24
|
+
:at => [110, 65],
|
25
|
+
:width => 80,
|
26
|
+
:size => 8
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
data/manual/images/images.rb
CHANGED
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("images.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "images" do |p|
|
11
|
-
|
12
10
|
p.section "Basics" do |s|
|
13
11
|
s.example "plain_image"
|
14
12
|
s.example "absolute_position"
|
@@ -35,6 +33,5 @@ Prawn::ManualBuilder::Example.generate("images.pdf", :page_size => "FOLIO") do
|
|
35
33
|
"How to configure the image dimensions by setting the width and height or by scaling it"
|
36
34
|
)
|
37
35
|
end
|
38
|
-
|
39
36
|
end
|
40
37
|
end
|
data/manual/layout/boxes.rb
CHANGED
@@ -17,11 +17,11 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
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
|
-
grid(4,0).show
|
21
|
-
grid(5,1).show
|
20
|
+
grid(4, 0).show
|
21
|
+
grid(5, 1).show
|
22
22
|
|
23
|
-
grid([6,2], [7,3]).show
|
23
|
+
grid([6, 2], [7, 3]).show
|
24
24
|
|
25
|
-
grid([4,4], [7,4]).show
|
26
|
-
grid([7,0], [7,1]).show
|
25
|
+
grid([4, 4], [7, 4]).show
|
26
|
+
grid([7, 0], [7, 1]).show
|
27
27
|
end
|
data/manual/layout/content.rb
CHANGED
@@ -15,11 +15,11 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
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
|
-
grid([5,0], [7,1]).bounding_box do
|
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
|
-
grid(6,3).bounding_box do
|
22
|
+
grid(6, 3).bounding_box do
|
23
23
|
text "Just a little snippet here.\n" + " _ " * 10
|
24
24
|
end
|
25
25
|
end
|
data/manual/layout/layout.rb
CHANGED
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("layout.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "layout" do |p|
|
11
|
-
|
12
10
|
p.example "simple_grid"
|
13
11
|
p.example "boxes"
|
14
12
|
p.example "content"
|
@@ -23,6 +21,5 @@ Prawn::ManualBuilder::Example.generate("layout.pdf", :page_size => "FOLIO") do
|
|
23
21
|
"How to create boxes according to the grid"
|
24
22
|
)
|
25
23
|
end
|
26
|
-
|
27
24
|
end
|
28
25
|
end
|
data/manual/outline/outline.rb
CHANGED
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("outline.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "outline" do |p|
|
11
|
-
|
12
10
|
p.section "Basics" do |s|
|
13
11
|
s.example "sections_and_pages", :eval_source => false
|
14
12
|
end
|
@@ -27,6 +25,5 @@ Prawn::ManualBuilder::Example.generate("outline.pdf", :page_size => "FOLIO") do
|
|
27
25
|
"How to insert sections and/or pages to a previously defined outline structure"
|
28
26
|
)
|
29
27
|
end
|
30
|
-
|
31
28
|
end
|
32
29
|
end
|
@@ -44,7 +44,7 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
44
44
|
number_pages string, options
|
45
45
|
|
46
46
|
# Gray page numbers from 8 on up
|
47
|
-
options[:page_filter] = lambda{ |pg| pg > 7}
|
47
|
+
options[:page_filter] = lambda{ |pg| pg > 7 }
|
48
48
|
options[:start_count_at] = 8
|
49
49
|
options[:color] = "333333"
|
50
50
|
number_pages string, options
|
@@ -6,9 +6,7 @@ require File.expand_path(File.join(File.dirname(__FILE__),
|
|
6
6
|
%w[.. example_helper]))
|
7
7
|
|
8
8
|
Prawn::ManualBuilder::Example.generate("repeatable_content.pdf", :page_size => "FOLIO") do
|
9
|
-
|
10
9
|
package "repeatable_content" do |p|
|
11
|
-
|
12
10
|
p.example "repeater", :eval_source => false
|
13
11
|
p.example "stamp"
|
14
12
|
p.example "page_numbering", :eval_source => false
|
@@ -27,6 +25,5 @@ Prawn::ManualBuilder::Example.generate("repeatable_content.pdf", :page_size => "
|
|
27
25
|
"How to number the document pages with one simple call"
|
28
26
|
)
|
29
27
|
end
|
30
|
-
|
31
28
|
end
|
32
29
|
end
|
@@ -25,19 +25,19 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
repeat(:odd) do
|
28
|
-
draw_text "Only odd pages", :at => [0,0]
|
28
|
+
draw_text "Only odd pages", :at => [0, 0]
|
29
29
|
end
|
30
30
|
|
31
31
|
repeat(:even) do
|
32
|
-
draw_text "Only even pages", :at => [0,0]
|
32
|
+
draw_text "Only even pages", :at => [0, 0]
|
33
33
|
end
|
34
34
|
|
35
|
-
repeat([1,3,7]) do
|
36
|
-
draw_text "Only on pages 1, 3 and 7", :at => [100,0]
|
35
|
+
repeat([1, 3, 7]) do
|
36
|
+
draw_text "Only on pages 1, 3 and 7", :at => [100, 0]
|
37
37
|
end
|
38
38
|
|
39
39
|
repeat(2..4) do
|
40
|
-
draw_text "From the 2nd to the 4th page", :at => [300,0]
|
40
|
+
draw_text "From the 2nd to the 4th page", :at => [300, 0]
|
41
41
|
end
|
42
42
|
|
43
43
|
repeat(lambda { |pg| pg % 3 == 0 }) do
|
@@ -50,6 +50,6 @@ Prawn::ManualBuilder::Example.generate(filename) do
|
|
50
50
|
|
51
51
|
10.times do
|
52
52
|
start_new_page
|
53
|
-
draw_text "A wonderful page", :at => [400,400]
|
53
|
+
draw_text "A wonderful page", :at => [400, 400]
|
54
54
|
end
|
55
55
|
end
|