pdf-writer 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +23 -1
- data/README +2 -2
- data/demo/colornames.rb +19 -823
- data/demo/demo.rb +2 -2
- data/demo/pac.rb +12 -12
- data/demo/pagenumber.rb +16 -12
- data/lib/pdf/charts/stddev.rb +10 -10
- data/lib/pdf/quickref.rb +5 -4
- data/lib/pdf/simpletable.rb +16 -16
- data/lib/pdf/techbook.rb +11 -11
- data/lib/pdf/writer.rb +136 -134
- data/lib/pdf/writer/graphics.rb +3 -3
- data/lib/pdf/writer/lang/en.rb +2 -1
- data/lib/pdf/writer/object/contents.rb +3 -2
- data/lib/pdf/writer/object/image.rb +150 -10
- data/manual.pwd +470 -117
- metadata +3 -4
- data/lib/pdf/grid.rb +0 -135
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: pdf-writer
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2005-
|
6
|
+
version: 1.1.2
|
7
|
+
date: 2005-08-25
|
8
8
|
summary: A pure Ruby PDF document creation library.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -38,7 +38,6 @@ files:
|
|
38
38
|
- lib/pdf
|
39
39
|
- lib/pdf/charts
|
40
40
|
- lib/pdf/charts.rb
|
41
|
-
- lib/pdf/grid.rb
|
42
41
|
- lib/pdf/math.rb
|
43
42
|
- lib/pdf/quickref.rb
|
44
43
|
- lib/pdf/simpletable.rb
|
@@ -132,7 +131,7 @@ dependencies:
|
|
132
131
|
-
|
133
132
|
- "~>"
|
134
133
|
- !ruby/object:Gem::Version
|
135
|
-
version: "1.
|
134
|
+
version: "1.3"
|
136
135
|
version:
|
137
136
|
- !ruby/object:Gem::Dependency
|
138
137
|
name: transaction-simple
|
data/lib/pdf/grid.rb
DELETED
@@ -1,135 +0,0 @@
|
|
1
|
-
#! /usr/bin/env ruby
|
2
|
-
#--
|
3
|
-
# PDF::Writer for Ruby.
|
4
|
-
# http://rubyforge.org/projects/ruby-pdf/
|
5
|
-
# Copyright 2003 - 2005 Austin Ziegler.
|
6
|
-
#
|
7
|
-
# Licensed under a MIT-style licence. See LICENCE in the main distribution
|
8
|
-
# for full licensing information.
|
9
|
-
#
|
10
|
-
# $Id: grid.rb,v 1.1 2005/06/07 04:19:58 austin Exp $
|
11
|
-
#++
|
12
|
-
require 'pdf/writer'
|
13
|
-
|
14
|
-
class PDF::Grid
|
15
|
-
# The scale of the grid lines in one direction. The scale always starts
|
16
|
-
# from the top or left of the page, depending on whether this is the X
|
17
|
-
# axis or Y axis. Minor lines are drawn before major lines.
|
18
|
-
class Scale
|
19
|
-
def initialize
|
20
|
-
@initial_gap = 0
|
21
|
-
|
22
|
-
yield self if block_given?
|
23
|
-
end
|
24
|
-
|
25
|
-
# The initial gap between the top or left of the page and the first
|
26
|
-
# grid line.
|
27
|
-
attr_accessor :initial_gap
|
28
|
-
# Major grid line style. The default is unset, which uses the current
|
29
|
-
# line style.
|
30
|
-
attr_accessor :major_style
|
31
|
-
# Major grid line colour. The default is unset, which uses the current
|
32
|
-
# line colour.
|
33
|
-
attr_accessor :major_color
|
34
|
-
# The number of units between each major line.
|
35
|
-
attr_accessor :major_step
|
36
|
-
# Minor grid line style. The default is unset, which uses the current
|
37
|
-
# line style.
|
38
|
-
attr_accessor :minor_style
|
39
|
-
# Minor grid line colour. The default is unset, which uses the current
|
40
|
-
# line colour.
|
41
|
-
attr_accessor :minor_color
|
42
|
-
# The number of units between each minor line.
|
43
|
-
attr_accessor :minor_step
|
44
|
-
end
|
45
|
-
|
46
|
-
def initialize
|
47
|
-
yield self if block_given?
|
48
|
-
end
|
49
|
-
|
50
|
-
# The X axis scale of the grid. X axis lines are drawn first.
|
51
|
-
attr_accessor :x_scale
|
52
|
-
# The Y axis scale of the grid. X axis lines are drawn first.
|
53
|
-
attr_accessor :y_scale
|
54
|
-
|
55
|
-
# Renders the grid on the document.
|
56
|
-
def render_on(pdf)
|
57
|
-
pdf.save_state
|
58
|
-
|
59
|
-
if @x_scale.minor_step and @x_scale.minor_step > 0
|
60
|
-
pdf.stroke_color! @x_scale.minor_color if @x_scale.minor_color
|
61
|
-
pdf.stroke_style! @x_scale.minor_style if @x_scale.minor_style
|
62
|
-
|
63
|
-
start = @x_scale.initial_gap
|
64
|
-
step = @x_scale.minor_step
|
65
|
-
|
66
|
-
start.step(pdf.page_width, step) do |x|
|
67
|
-
line(x, 0, x, pdf.page_height).stroke
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
if @y_scale.minor_step and @y_scale.minor_step > 0
|
72
|
-
pdf.stroke_color! @y_scale.minor_color if @y_scale.minor_color
|
73
|
-
pdf.stroke_style! @y_scale.minor_style if @y_scale.minor_style
|
74
|
-
|
75
|
-
start = pdf.page_height - @y_scale.initial_gap
|
76
|
-
step = -@y_scale.minor_step
|
77
|
-
|
78
|
-
start.step(0, step) do |y|
|
79
|
-
line(0, y, pdf.page_width, y).stroke
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
if @x_scale.major_step and @x_scale.major_step > 0
|
84
|
-
pdf.stroke_color! @x_scale.major_color if @x_scale.major_color
|
85
|
-
pdf.stroke_style! @x_scale.major_style if @x_scale.major_style
|
86
|
-
|
87
|
-
start = @x_scale.initial_gap
|
88
|
-
step = @x_scale.major_step
|
89
|
-
|
90
|
-
start.step(pdf.page_width, step) do |x|
|
91
|
-
line(x, 0, x, pdf.page_height).stroke
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
if @y_scale.major_step and @y_scale.major_step > 0
|
96
|
-
pdf.stroke_color! @y_scale.major_color if @y_scale.major_color
|
97
|
-
pdf.stroke_style! @y_scale.major_style if @y_scale.major_style
|
98
|
-
|
99
|
-
start = pdf.page_height - @y_scale.initial_gap
|
100
|
-
step = -@y_scale.major_step
|
101
|
-
|
102
|
-
start.step(0, step) do |y|
|
103
|
-
line(0, y, pdf.page_width, y).stroke
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
# stroke_color(Color::Grey60)
|
108
|
-
# y = absolute_top_margin
|
109
|
-
# line(0, y, @page_width, y).stroke
|
110
|
-
# line(0, @bottom_margin, @page_width, @bottom_margin).stroke
|
111
|
-
# line(@left_margin, 0, @left_margin, @page_height).stroke
|
112
|
-
# x = absolute_right_margin
|
113
|
-
# line(x, 0, x, @page_height).stroke
|
114
|
-
# y = @page_height / 2.0
|
115
|
-
# line(0, y, @left_margin, y).stroke
|
116
|
-
# x = absolute_right_margin
|
117
|
-
# line(x, y, @page_width, y).stroke
|
118
|
-
# x = @page_width / 2.0
|
119
|
-
# line(x, 0, x, @bottom_margin).stroke
|
120
|
-
# y = absolute_top_margin
|
121
|
-
# line(x, y, x, @page_height).stroke
|
122
|
-
|
123
|
-
# 0.step(@page_width, 10) do |x|
|
124
|
-
# add_text(x, 0, 3, x.to_s)
|
125
|
-
# add_text(x, @page_height - 3, 3, x.to_s)
|
126
|
-
# end
|
127
|
-
|
128
|
-
# 0.step(@page_height, 10) do |y|
|
129
|
-
# add_text(0, y, 3, y.to_s)
|
130
|
-
# add_text(@page_width - 5, y, 3, y.to_s)
|
131
|
-
# end
|
132
|
-
|
133
|
-
restore_state
|
134
|
-
end
|
135
|
-
end
|