prawn 0.11.1 → 0.12.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.
- data/GPLv2 +340 -0
- data/GPLv3 +674 -0
- data/README.md +96 -0
- data/Rakefile +0 -12
- data/examples/example_helper.rb +3 -0
- data/lib/prawn.rb +1 -1
- data/lib/prawn/core/page.rb +4 -2
- data/lib/prawn/core/pdf_object.rb +7 -7
- data/lib/prawn/core/text/formatted/arranger.rb +2 -1
- data/lib/prawn/core/text/formatted/line_wrap.rb +2 -1
- data/lib/prawn/core/text/formatted/wrap.rb +5 -1
- data/lib/prawn/document.rb +135 -112
- data/lib/prawn/document/bounding_box.rb +51 -5
- data/lib/prawn/document/column_box.rb +0 -19
- data/lib/prawn/document/internals.rb +1 -0
- data/lib/prawn/document/snapshot.rb +3 -0
- data/lib/prawn/font.rb +4 -3
- data/lib/prawn/font/afm.rb +11 -2
- data/lib/prawn/font/ttf.rb +15 -0
- data/lib/prawn/images.rb +1 -1
- data/lib/prawn/table.rb +23 -7
- data/lib/prawn/table/cell.rb +31 -9
- data/lib/prawn/table/cell/text.rb +2 -2
- data/prawn.gemspec +5 -6
- data/spec/bounding_box_spec.rb +157 -0
- data/spec/data/curves.pdf +66 -0
- data/spec/document_spec.rb +59 -4
- data/spec/extensions/mocha.rb +1 -3
- data/spec/font_spec.rb +23 -0
- data/spec/formatted_text_box_spec.rb +40 -0
- data/spec/images_spec.rb +7 -0
- data/spec/object_store_spec.rb +3 -3
- data/spec/snapshot_spec.rb +33 -0
- data/spec/table_spec.rb +75 -0
- data/spec/template_spec.rb +11 -5
- data/spec/text_spacing_spec.rb +18 -0
- data/spec/text_spec.rb +32 -0
- metadata +217 -283
- data/HACKING +0 -50
- data/README +0 -141
- data/examples/bounding_box/bounding_boxes.rb +0 -44
- data/examples/bounding_box/indentation.rb +0 -35
- data/examples/bounding_box/stretched_nesting.rb +0 -68
- data/examples/general/background.rb +0 -24
- data/examples/general/canvas.rb +0 -16
- data/examples/general/float.rb +0 -12
- data/examples/general/margin.rb +0 -37
- data/examples/general/measurement_units.rb +0 -52
- data/examples/general/metadata-info.rb +0 -17
- data/examples/general/multi_page_layout.rb +0 -19
- data/examples/general/outlines.rb +0 -67
- data/examples/general/page_geometry.rb +0 -32
- data/examples/general/page_numbering.rb +0 -40
- data/examples/general/page_templates.rb +0 -20
- data/examples/general/repeaters.rb +0 -48
- data/examples/general/stamp.rb +0 -42
- data/examples/general/templates.rb +0 -14
- data/examples/graphics/basic_images.rb +0 -24
- data/examples/graphics/curves.rb +0 -12
- data/examples/graphics/hexagon.rb +0 -14
- data/examples/graphics/image_fit.rb +0 -16
- data/examples/graphics/image_flow.rb +0 -38
- data/examples/graphics/image_position.rb +0 -18
- data/examples/graphics/line.rb +0 -33
- data/examples/graphics/polygons.rb +0 -17
- data/examples/graphics/rounded_polygons.rb +0 -20
- data/examples/graphics/rounded_rectangle.rb +0 -21
- data/examples/graphics/ruport_style_helpers.rb +0 -20
- data/examples/graphics/stroke_bounds.rb +0 -21
- data/examples/graphics/stroke_cap_and_join.rb +0 -46
- data/examples/graphics/stroke_dash.rb +0 -43
- data/examples/graphics/transformations.rb +0 -53
- data/examples/graphics/transparency.rb +0 -27
- data/examples/grid/bounding_boxes.rb +0 -22
- data/examples/grid/column_gutter_grid.rb +0 -21
- data/examples/grid/multi_boxes.rb +0 -52
- data/examples/grid/show_grid.rb +0 -14
- data/examples/grid/simple_grid.rb +0 -21
- data/examples/m17n/chinese_text_wrapping.rb +0 -18
- data/examples/m17n/euro.rb +0 -16
- data/examples/m17n/utf8.rb +0 -14
- data/examples/security/hello_foo.rb +0 -9
- data/examples/table/borders.rb +0 -25
- data/examples/table/cell.rb +0 -13
- data/examples/table/checkerboard.rb +0 -23
- data/examples/table/inline_format_table.rb +0 -13
- data/examples/table/multi_page_table.rb +0 -10
- data/examples/table/simple_table.rb +0 -25
- data/examples/table/subtable.rb +0 -13
- data/examples/table/widths.rb +0 -21
- data/examples/text/alignment.rb +0 -19
- data/examples/text/character_spacing.rb +0 -13
- data/examples/text/dfont.rb +0 -49
- data/examples/text/family_based_styling.rb +0 -25
- data/examples/text/font_size.rb +0 -34
- data/examples/text/inline_format.rb +0 -104
- data/examples/text/kerning.rb +0 -31
- data/examples/text/rendering_mode.rb +0 -21
- data/examples/text/rotated.rb +0 -99
- data/examples/text/shaped_text_box.rb +0 -32
- data/examples/text/simple_text.rb +0 -18
- data/examples/text/simple_text_ttf.rb +0 -18
- data/examples/text/span.rb +0 -30
- data/examples/text/text_box.rb +0 -90
- data/examples/text/text_box_returning_excess.rb +0 -52
- data/examples/text/text_flow.rb +0 -68
@@ -1,17 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Basic polygon drawing example. See also: hexagon.rb
|
4
|
-
#
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
pdf = Prawn::Document.new
|
9
|
-
|
10
|
-
10.times do |i|
|
11
|
-
pdf.stroke_polygon [ 50 + i*25, 50 + i*25],
|
12
|
-
[100 + i*25, 50 + i*25],
|
13
|
-
[100 + i*25, 100 + i*25]
|
14
|
-
pdf.stroke_rectangle [0,600], 5*i, 10*i
|
15
|
-
end
|
16
|
-
|
17
|
-
pdf.render_file "pretty_polygons.pdf"
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
2
|
-
%w[.. example_helper]))
|
3
|
-
|
4
|
-
def radian(degree)
|
5
|
-
Math::PI/180*degree
|
6
|
-
end
|
7
|
-
|
8
|
-
def point_on_circle(center, radius, degrees)
|
9
|
-
[center[0] + radius*(Math.cos(radian(degrees))), center[1] - radius*(Math.sin(radian(degrees)))]
|
10
|
-
end
|
11
|
-
|
12
|
-
pdf = Prawn::Document.new
|
13
|
-
|
14
|
-
pentagon_points = (0..4).map{|i| point_on_circle([200, 400], 100, i * 72)}
|
15
|
-
pentagram_points = [0, 2, 4, 1, 3].map{|i| pentagon_points[i]}
|
16
|
-
pdf.stroke_rounded_polygon(20, *pentagram_points)
|
17
|
-
pdf.fill_and_stroke_rounded_polygon(10, [100, 250], [200, 300], [300, 250],
|
18
|
-
[300, 150], [200, 100], [100, 150])
|
19
|
-
|
20
|
-
pdf.render_file "rounded_polygon.pdf"
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Rounded rectangle example demonstrating both stroke and stroke and fill.
|
4
|
-
# A rectangle with rounded join_style is added just for comparison.
|
5
|
-
#
|
6
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
7
|
-
%w[.. example_helper]))
|
8
|
-
|
9
|
-
pdf = Prawn::Document.new
|
10
|
-
pdf.font_size 8
|
11
|
-
pdf.draw_text "a stroked rounded rectangle:", :at => [30, 575]
|
12
|
-
pdf.stroke_rounded_rectangle([50, 550], 50, 100, 10)
|
13
|
-
pdf.draw_text "a stroked and filled rounded rectangle:", :at => [180, 575]
|
14
|
-
pdf.fill_and_stroke_rounded_rectangle([200, 550], 50, 100, 10)
|
15
|
-
pdf.draw_text "a regular rectangle with rounded join style;", :at => [330, 575]
|
16
|
-
pdf.draw_text "needs thick line width for similar result:", :at => [330, 565]
|
17
|
-
pdf.join_style :round
|
18
|
-
pdf.line_width 10
|
19
|
-
pdf.stroke_rectangle([350, 550], 50, 100)
|
20
|
-
|
21
|
-
pdf.render_file "rounded_rectangle.pdf"
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# These helpers will be familiar to Ruport users, and now are supported
|
4
|
-
# directly in Prawn. Run the example to see how they work.
|
5
|
-
#
|
6
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
7
|
-
%w[.. example_helper]))
|
8
|
-
|
9
|
-
# Demonstrates some features stolen from Ruport::Formatter::PDF
|
10
|
-
Prawn::Document.generate("ruport.pdf") do
|
11
|
-
move_down 50
|
12
|
-
# TODO: Figure out where to set the y cursor to.
|
13
|
-
stroke_horizontal_rule
|
14
|
-
text "Hi there"
|
15
|
-
pad(50) { text "I'm Padded" }
|
16
|
-
text "I'm far away"
|
17
|
-
stroke_horizontal_line 50, 100
|
18
|
-
stroke_horizontal_line 50, 100, :at => 300
|
19
|
-
stroke_vertical_line 300, 50, :at => 250
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Demonstrates Document#stroke_bounds, which will stroke a rectange outlining
|
4
|
-
# the boundaries of the current bounding box. This is useful for debugging
|
5
|
-
# and can also be used as a light-weight and lower level alternative to
|
6
|
-
# Cells.
|
7
|
-
#
|
8
|
-
# Feature borrowed from Josh Knowle's pt at:
|
9
|
-
# http://github.com/joshknowles/pt/tree/master
|
10
|
-
#
|
11
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
12
|
-
%w[.. example_helper]))
|
13
|
-
|
14
|
-
Prawn::Document.generate("stroke_bounds.pdf") do
|
15
|
-
stroke_bounds
|
16
|
-
|
17
|
-
bounding_box [100,500], :width => 200, :height => 300 do
|
18
|
-
text "Hey there, here's some text. " * 10
|
19
|
-
stroke_bounds
|
20
|
-
end
|
21
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Stroke dashing can be applied to any line or curve
|
4
|
-
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
Prawn::Document.generate("stroke_cap_and_join.pdf") do
|
9
|
-
self.line_width = 25
|
10
|
-
x0 = bounds.left + 100
|
11
|
-
x1 = bounds.left + 200
|
12
|
-
x2 = bounds.left + 300
|
13
|
-
|
14
|
-
y = bounds.top - 125
|
15
|
-
|
16
|
-
3.times do |i|
|
17
|
-
case i
|
18
|
-
when 0
|
19
|
-
self.join_style = :miter
|
20
|
-
when 1
|
21
|
-
self.join_style = :round
|
22
|
-
when 2
|
23
|
-
self.join_style = :bevel
|
24
|
-
end
|
25
|
-
stroke do
|
26
|
-
move_to(x0, y)
|
27
|
-
line_to(x1, y + 100)
|
28
|
-
line_to(x2, y)
|
29
|
-
end
|
30
|
-
y -= 100
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
3.times do |i|
|
35
|
-
case i
|
36
|
-
when 0
|
37
|
-
self.cap_style = :butt
|
38
|
-
when 1
|
39
|
-
self.cap_style = :round
|
40
|
-
when 2
|
41
|
-
self.cap_style = :projecting_square
|
42
|
-
end
|
43
|
-
stroke_line([x0, y, x2, y])
|
44
|
-
y -= 30
|
45
|
-
end
|
46
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Stroke dashing can be applied to any line or curve
|
4
|
-
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
Prawn::Document.generate("stroke_dash.pdf") do
|
9
|
-
self.line_width = 1
|
10
|
-
base_y = bounds.top
|
11
|
-
|
12
|
-
100.times do |i|
|
13
|
-
length = i / 4 + 1
|
14
|
-
# space between dashes same length as dash
|
15
|
-
space = length
|
16
|
-
# start with dash
|
17
|
-
phase = 0
|
18
|
-
case i % 4
|
19
|
-
when 0
|
20
|
-
base_y -= 10
|
21
|
-
when 1
|
22
|
-
# start with space between dashes
|
23
|
-
phase = length
|
24
|
-
when 2
|
25
|
-
base_y -= 10
|
26
|
-
# space between dashes half as long as dash
|
27
|
-
space = length * 0.5
|
28
|
-
when 3
|
29
|
-
# space between dashes half as long as dash
|
30
|
-
space = length * 0.5
|
31
|
-
# start with space between dashes
|
32
|
-
phase = length
|
33
|
-
end
|
34
|
-
dash(length, :space => space, :phase => phase)
|
35
|
-
points = [bounds.left, base_y - 2 * i, bounds.right, base_y - 2 * i]
|
36
|
-
stroke_line(points)
|
37
|
-
end
|
38
|
-
i = 100
|
39
|
-
base_y -= 10
|
40
|
-
undash
|
41
|
-
points = [bounds.left, base_y - 2 * i, bounds.right, base_y - 2 * i]
|
42
|
-
stroke_line(points)
|
43
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Demonstrates transformations
|
4
|
-
#
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
Prawn::Document.generate "transformations.pdf" do |pdf|
|
9
|
-
width = 50
|
10
|
-
height = 100
|
11
|
-
|
12
|
-
# ROTATION
|
13
|
-
x = 50
|
14
|
-
y = pdf.bounds.top - 50
|
15
|
-
|
16
|
-
pdf.stroke_rectangle([x, y], width, height)
|
17
|
-
pdf.draw_text("reference rectangle", :at => [x + width, y - height])
|
18
|
-
pdf.rotate(30, :origin => [x, y]) do
|
19
|
-
pdf.stroke_rectangle([x, y], width, height)
|
20
|
-
pdf.draw_text("rectangle rotated around upper-left corner", :at => [x + width, y - height])
|
21
|
-
end
|
22
|
-
|
23
|
-
x = 50
|
24
|
-
y = pdf.bounds.top - 200
|
25
|
-
|
26
|
-
pdf.stroke_rectangle([x, y], width, height)
|
27
|
-
pdf.draw_text("reference rectangle", :at => [x + width, y - height])
|
28
|
-
pdf.rotate(30, :origin => [x + width / 2, y - height / 2]) do
|
29
|
-
pdf.stroke_rectangle([x, y], width, height)
|
30
|
-
pdf.draw_text("rectangle rotated around center", :at => [x + width, y - height])
|
31
|
-
end
|
32
|
-
|
33
|
-
# SCALE
|
34
|
-
x = 0
|
35
|
-
y = pdf.bounds.top - 500
|
36
|
-
|
37
|
-
pdf.stroke_rectangle([x, y], width, height)
|
38
|
-
pdf.draw_text("reference rectangle", :at => [x + width, y - height])
|
39
|
-
pdf.scale(2, :origin => [x, y]) do
|
40
|
-
pdf.stroke_rectangle([x, y], width, height)
|
41
|
-
pdf.draw_text("rectangle scaled from upper-left corner", :at => [x + width, y - height])
|
42
|
-
end
|
43
|
-
|
44
|
-
x = 150
|
45
|
-
y = pdf.bounds.top - 400
|
46
|
-
|
47
|
-
pdf.stroke_rectangle([x, y], width, height)
|
48
|
-
pdf.draw_text("reference rectangle", :at => [x + width, y - height])
|
49
|
-
pdf.scale(2, :origin => [x + width / 2, y - height / 2]) do
|
50
|
-
pdf.stroke_rectangle([x, y], width, height)
|
51
|
-
pdf.draw_text("rectangle scaled from center", :at => [x + width, y - height])
|
52
|
-
end
|
53
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Demonstrate use of transparency
|
4
|
-
#
|
5
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
-
%w[.. example_helper]))
|
7
|
-
|
8
|
-
Prawn::Document.generate("transparency.pdf") do
|
9
|
-
fill_color("ff0000")
|
10
|
-
fill_circle([200, 200], 200)
|
11
|
-
transparent(0.5, 1) do
|
12
|
-
fill_color("000000")
|
13
|
-
stroke_color("ffffff")
|
14
|
-
fill_and_stroke_circle([300, 300], 200)
|
15
|
-
fill_color("ffffff")
|
16
|
-
text "transparency " * 150, :size => 18
|
17
|
-
end
|
18
|
-
|
19
|
-
start_new_page
|
20
|
-
|
21
|
-
fill_color("000000")
|
22
|
-
fill_rectangle([0, bounds.top], 200, 100)
|
23
|
-
transparent(0.5) do
|
24
|
-
fill_color("ff0000")
|
25
|
-
fill_rectangle([100, bounds.top - 50], 200, 100)
|
26
|
-
end
|
27
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
4
|
-
%w[.. example_helper]))
|
5
|
-
|
6
|
-
Prawn::Document.generate('bounding_box_grid.pdf') do |p|
|
7
|
-
p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
8
|
-
|
9
|
-
p.stroke_color = "ff0000"
|
10
|
-
|
11
|
-
p.grid.rows.times do |i|
|
12
|
-
p.grid.columns.times do |j|
|
13
|
-
p.grid(i,j).bounding_box do
|
14
|
-
p.text p.grid(i,j).name
|
15
|
-
p.stroke do
|
16
|
-
p.rectangle(p.bounds.top_left, p.bounds.width, p.bounds.height)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
4
|
-
%w[.. example_helper]))
|
5
|
-
|
6
|
-
Prawn::Document.generate('column_gutter_grid.pdf') do |p|
|
7
|
-
p.define_grid(:columns => 3, :rows => 10, :column_gutter => 10)
|
8
|
-
|
9
|
-
p.grid.rows.times do |i|
|
10
|
-
p.grid.columns.times do |j|
|
11
|
-
b = p.grid(i,j)
|
12
|
-
p.bounding_box b.top_left, :width => b.width, :height => b.height do
|
13
|
-
p.text b.name
|
14
|
-
p.stroke do
|
15
|
-
p.rectangle(p.bounds.top_left, b.width, b.height)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
4
|
-
%w[.. example_helper]))
|
5
|
-
|
6
|
-
Prawn::Document.generate('multi_boxes.pdf') do |p|
|
7
|
-
p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
8
|
-
|
9
|
-
p.grid.rows.times do |i|
|
10
|
-
p.grid.columns.times do |j|
|
11
|
-
p.grid(i,j).bounding_box do
|
12
|
-
p.text p.grid(i,j).name
|
13
|
-
p.stroke_color = "cccccc"
|
14
|
-
p.stroke do
|
15
|
-
p.rectangle(p.bounds.top_left, p.bounds.width, p.bounds.height)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
g = p.grid([0,0], [1,1])
|
22
|
-
g.bounding_box do
|
23
|
-
p.move_down 12
|
24
|
-
p.text g.name
|
25
|
-
p.stroke_color = "333333"
|
26
|
-
p.stroke do
|
27
|
-
p.rectangle(p.bounds.top_left, p.bounds.width, p.bounds.height)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
g = p.grid([3,0], [3,3])
|
32
|
-
g.bounding_box do
|
33
|
-
p.move_down 12
|
34
|
-
p.text g.name
|
35
|
-
p.stroke_color = "333333"
|
36
|
-
p.stroke do
|
37
|
-
p.rectangle(p.bounds.top_left, p.bounds.width, p.bounds.height)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
g = p.grid([4,0], [5,1])
|
42
|
-
g.bounding_box do
|
43
|
-
p.move_down 12
|
44
|
-
p.text g.name
|
45
|
-
p.stroke_color = "333333"
|
46
|
-
p.stroke do
|
47
|
-
p.rectangle(p.bounds.top_left, p.bounds.width, p.bounds.height)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
data/examples/grid/show_grid.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
4
|
-
%w[.. example_helper]))
|
5
|
-
|
6
|
-
Prawn::Document.generate('show_grid.pdf') do |p|
|
7
|
-
p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
8
|
-
|
9
|
-
p.grid.show_all
|
10
|
-
|
11
|
-
p.grid(2,4).show("FF0000")
|
12
|
-
p.grid([3,0], [5,3]).show("0000FF")
|
13
|
-
end
|
14
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
4
|
-
%w[.. example_helper]))
|
5
|
-
|
6
|
-
Prawn::Document.generate('simple_grid.pdf') do |p|
|
7
|
-
p.define_grid(:columns => 5, :rows => 8, :gutter => 10)
|
8
|
-
|
9
|
-
p.grid.rows.times do |i|
|
10
|
-
p.grid.columns.times do |j|
|
11
|
-
b = p.grid(i,j)
|
12
|
-
p.bounding_box b.top_left, :width => b.width, :height => b.height do
|
13
|
-
p.text b.name
|
14
|
-
p.stroke do
|
15
|
-
p.rectangle(p.bounds.top_left, b.width, b.height)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
#
|
4
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
5
|
-
%w[.. example_helper]))
|
6
|
-
|
7
|
-
start = Time.now
|
8
|
-
Prawn::Document.generate("chinese_flow.pdf") do
|
9
|
-
font "#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf"
|
10
|
-
font_size 16
|
11
|
-
|
12
|
-
long_text = "更可怕的是,同质化竞争对手可以按照URL中后面这个ID来遍历您的DB中的内容,写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事,这样的话,你就非常被动了。写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事写个小爬虫把你的页面上的关键信息顺次爬下来也不是什么难事"
|
13
|
-
text long_text
|
14
|
-
|
15
|
-
# be sure to restore space based wrapping when dealing with latin scripts
|
16
|
-
long_text = "Text with some spaces " * 25
|
17
|
-
text long_text
|
18
|
-
end
|
data/examples/m17n/euro.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# As of Prawn 0.3, it is possible to generate a Euro using the built-in
|
4
|
-
# AFM files. However, you need to be sure to manually add spacing around it,
|
5
|
-
# as its calculated width in the AFM files seem to be wrong.
|
6
|
-
#
|
7
|
-
# We are investigating this issue, but it does not seem to be Prawn specific.
|
8
|
-
# If you need precision spacing, use a TTF file instead and the issue will
|
9
|
-
# go away.
|
10
|
-
#
|
11
|
-
require File.expand_path(File.join(File.dirname(__FILE__),
|
12
|
-
%w[.. example_helper]))
|
13
|
-
|
14
|
-
Prawn::Document.generate "euro.pdf" do
|
15
|
-
text "A Euro! € ©", :size => 32
|
16
|
-
end
|