pdf-labels 1.0.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -1
- data/LICENCE +0 -0
- data/Manifest.txt +32 -31
- data/Rakefile +2 -2
- data/fonts/Code128.afm +275 -0
- data/fonts/Code128.pfb +0 -0
- data/fonts/Code128.ttf +0 -0
- data/fonts/Code2of5interleaved.afm +275 -0
- data/fonts/Code2of5interleaved.pfb +0 -0
- data/fonts/Code2of5interleaved.ttf +0 -0
- data/fonts/Code3de9.afm +275 -0
- data/fonts/Code3de9.pfb +0 -0
- data/fonts/Code3de9.ttf +0 -0
- data/fonts/CodeDatamatrix.afm +275 -0
- data/fonts/CodeDatamatrix.pfb +0 -0
- data/fonts/CodeDatamatrix.ttf +0 -0
- data/fonts/CodeEAN13.afm +275 -0
- data/fonts/CodeEAN13.pfb +0 -0
- data/fonts/CodeEAN13.ttf +0 -0
- data/fonts/CodePDF417.afm +275 -0
- data/fonts/CodePDF417.pfb +0 -0
- data/fonts/CodePDF417.ttf +0 -0
- data/init.rb +2 -0
- data/lib/pdf/label.rb +12 -0
- data/lib/pdf/label/alias.rb +11 -0
- data/lib/pdf/label/batch.rb +276 -0
- data/lib/pdf/label/glabel_template.rb +38 -0
- data/lib/pdf/label/label.rb +55 -0
- data/lib/pdf/label/layout.rb +15 -0
- data/lib/pdf/label/length_node.rb +52 -0
- data/lib/pdf/label/markup.rb +26 -0
- data/lib/pdf/label/template.rb +39 -0
- data/pdf-labels-patch-to-r62.txt +98 -0
- data/templates/avery-us-templates.xml +0 -0
- data/templates/glabels-2.0.dtd +0 -0
- data/test/test_pdf_label_page.rb +76 -18
- data/vendor/pdf/writer.rb +4 -1
- data/vendor/pdf/writer/object/font.rb +4 -4
- data/vendor/pdf/writer/object/viewerpreferences.rb +2 -2
- data/vendor/pdf_writer_font_patch.diff +35 -0
- metadata +84 -66
- data/lib/alias.rb +0 -8
- data/lib/glabel_template.rb +0 -36
- data/lib/label.rb +0 -52
- data/lib/layout.rb +0 -13
- data/lib/length_node.rb +0 -47
- data/lib/markup.rb +0 -25
- data/lib/pdf_label_page.rb +0 -171
- data/lib/pdf_labels.rb +0 -3
- data/lib/template.rb +0 -37
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/length_node')
|
2
|
+
|
3
|
+
module Pdf
|
4
|
+
module Label
|
5
|
+
class MarkupMargin
|
6
|
+
include XML::Mapping
|
7
|
+
length_node :size, "@size"
|
8
|
+
|
9
|
+
end
|
10
|
+
|
11
|
+
class MarkupLine
|
12
|
+
include XML::Mapping
|
13
|
+
length_node :x1, "@x1"
|
14
|
+
length_node :y1, "@y1"
|
15
|
+
length_node :x2, "@x2"
|
16
|
+
length_node :y2, "@y2"
|
17
|
+
end
|
18
|
+
|
19
|
+
class MarkupCircle
|
20
|
+
include XML::Mapping
|
21
|
+
length_node :x0, "@x0"
|
22
|
+
length_node :y0, "@y0"
|
23
|
+
length_node :radius, "@radius"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/alias')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/label')
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/markup')
|
4
|
+
|
5
|
+
module Pdf
|
6
|
+
module Label
|
7
|
+
class Template
|
8
|
+
include XML::Mapping
|
9
|
+
attr_accessor :labels
|
10
|
+
|
11
|
+
text_node :name, "@name"
|
12
|
+
text_node :size, "@size"
|
13
|
+
text_node :description, "@description", :default_value => ""
|
14
|
+
text_node :_description, "@_description", :default_value => ""
|
15
|
+
length_node :width, "@width", :default_value => nil
|
16
|
+
length_node :height, "@height", :default_value => nil
|
17
|
+
|
18
|
+
#TODO this could be cleaner, but I'm not sure how yet
|
19
|
+
hash_node :labelRectangles, "Label-rectangle", "@id", :class => LabelRectangle, :default_value => nil
|
20
|
+
hash_node :labelRounds, "Label-round", "@id", :class => LabelRound, :default_value => nil
|
21
|
+
hash_node :labelCDs, "Label-cd", "@id", :class => LabelCD, :default_value => nil
|
22
|
+
|
23
|
+
hash_node :alias, "Alias", "@name", :class => Alias, :default_value => Hash.new
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
def labels
|
30
|
+
@labels = Hash.new
|
31
|
+
@labels = @labels.merge @labelRectangles
|
32
|
+
@labels = @labels.merge @labelRounds
|
33
|
+
@labels = @labels.merge @labelCDs
|
34
|
+
@labels
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/init.rb
|
2
|
+
===================================================================
|
3
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/init.rb (revision 0)
|
4
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/init.rb (revision 0)
|
5
|
+
@@ -0,0 +1 @@
|
6
|
+
+require 'pdf/label'
|
7
|
+
|
8
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/alias.rb
|
9
|
+
===================================================================
|
10
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/alias.rb (revision 62)
|
11
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/alias.rb (working copy)
|
12
|
+
@@ -1,5 +1,5 @@
|
13
|
+
require 'xml/mapping'
|
14
|
+
-require 'length_node'
|
15
|
+
+require File.expand_path(File.dirname(__FILE__) + '/length_node')
|
16
|
+
|
17
|
+
module Pdf
|
18
|
+
module Label
|
19
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/batch.rb
|
20
|
+
===================================================================
|
21
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/batch.rb (revision 62)
|
22
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/batch.rb (working copy)
|
23
|
+
@@ -1,6 +1,6 @@
|
24
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/../../../vendor")
|
25
|
+
require 'xml/mapping'
|
26
|
+
-require 'glabel_template'
|
27
|
+
+require File.expand_path(File.dirname(__FILE__) + '/glabel_template')
|
28
|
+
require 'pdf/writer'
|
29
|
+
#--- require 'breakpoint'
|
30
|
+
|
31
|
+
@@ -10,7 +10,7 @@
|
32
|
+
attr_accessor :gt, :template, :label, :pdf, :barcode_font
|
33
|
+
@@gt = nil
|
34
|
+
def initialize(template_name, pdf_opts = {})
|
35
|
+
- @@gt || self.load_template_set
|
36
|
+
+ @@gt || self.class.load_template_set
|
37
|
+
unless @template = @@gt.find_template(template_name)
|
38
|
+
raise "Template not found!"
|
39
|
+
end
|
40
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/glabel_template.rb
|
41
|
+
===================================================================
|
42
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/glabel_template.rb (revision 62)
|
43
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/glabel_template.rb (working copy)
|
44
|
+
@@ -1,5 +1,4 @@
|
45
|
+
-require 'template'
|
46
|
+
-
|
47
|
+
+require File.expand_path(File.dirname(__FILE__) + '/template')
|
48
|
+
module Pdf
|
49
|
+
module Label
|
50
|
+
class GlabelsTemplate
|
51
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/label.rb
|
52
|
+
===================================================================
|
53
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/label.rb (revision 62)
|
54
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/label.rb (working copy)
|
55
|
+
@@ -1,6 +1,6 @@
|
56
|
+
-require 'length_node'
|
57
|
+
-require 'layout'
|
58
|
+
-require 'markup'
|
59
|
+
+require File.expand_path(File.dirname(__FILE__) + '/length_node')
|
60
|
+
+require File.expand_path(File.dirname(__FILE__) + '/layout')
|
61
|
+
+require File.expand_path(File.dirname(__FILE__) + '/markup')
|
62
|
+
|
63
|
+
module Pdf
|
64
|
+
module Label
|
65
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/layout.rb
|
66
|
+
===================================================================
|
67
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/layout.rb (revision 62)
|
68
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/layout.rb (working copy)
|
69
|
+
@@ -1,4 +1,4 @@
|
70
|
+
-require 'length_node'
|
71
|
+
+require File.expand_path(File.dirname(__FILE__) + '/length_node')
|
72
|
+
|
73
|
+
module Pdf
|
74
|
+
module Label
|
75
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/markup.rb
|
76
|
+
===================================================================
|
77
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/markup.rb (revision 62)
|
78
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/markup.rb (working copy)
|
79
|
+
@@ -1,4 +1,4 @@
|
80
|
+
-require 'length_node'
|
81
|
+
+require File.expand_path(File.dirname(__FILE__) + '/length_node')
|
82
|
+
|
83
|
+
module Pdf
|
84
|
+
module Label
|
85
|
+
Index: /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/template.rb
|
86
|
+
===================================================================
|
87
|
+
--- /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/template.rb (revision 62)
|
88
|
+
+++ /home/jgarvin/workspace/contacts/vendor/plugins/pdf-labels/lib/pdf/label/template.rb (working copy)
|
89
|
+
@@ -1,6 +1,6 @@
|
90
|
+
-require 'alias'
|
91
|
+
-require 'label'
|
92
|
+
-require 'markup'
|
93
|
+
+require File.expand_path(File.dirname(__FILE__) + '/alias')
|
94
|
+
+require File.expand_path(File.dirname(__FILE__) + '/label')
|
95
|
+
+require File.expand_path(File.dirname(__FILE__) + '/markup')
|
96
|
+
|
97
|
+
module Pdf
|
98
|
+
module Label
|
File without changes
|
data/templates/glabels-2.0.dtd
CHANGED
File without changes
|
data/test/test_pdf_label_page.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
|
2
2
|
require 'test/unit'
|
3
|
-
require '
|
3
|
+
require 'pdf/label'
|
4
4
|
|
5
|
-
class
|
5
|
+
class TestPdfLabelBatch < Test::Unit::TestCase
|
6
6
|
ROOT = File.expand_path(File.dirname(__FILE__) + "/../")
|
7
7
|
def setup
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_new_with_tempalte_name
|
11
|
-
p =
|
11
|
+
p = Pdf::Label::Batch.new("Avery 5366")
|
12
12
|
assert p
|
13
13
|
assert_equal p.template.name, "Avery 5366"
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_new_with_alias_name
|
17
|
-
p =
|
17
|
+
p = Pdf::Label::Batch.new("Avery 8166")
|
18
18
|
assert p
|
19
19
|
assert_equal p.template.name, "Avery 5366"
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_new_with_paper_type
|
23
|
-
p =
|
23
|
+
p = Pdf::Label::Batch.new("Avery 5366", {:paper => 'Legal'})
|
24
24
|
assert p
|
25
25
|
assert_equal p.pdf.page_width, 612.0
|
26
26
|
assert_equal p.pdf.page_height, 1008.0
|
@@ -28,25 +28,25 @@ class TestPDFLabelPage < Test::Unit::TestCase
|
|
28
28
|
|
29
29
|
def test_new_with_tempalte_not_found
|
30
30
|
assert_raise(RuntimeError) {
|
31
|
-
p =
|
31
|
+
p = Pdf::Label::Batch.new("Some Non-Existing")
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
35
|
#TODO other options are possible for pdf_options, we need to test those at some point
|
36
36
|
|
37
|
-
def
|
38
|
-
|
37
|
+
def test_PdfLabelBatch_load_tempalte_set
|
38
|
+
Pdf::Label::Batch.load_template_set("#{ROOT}/templates/avery-iso-templates.xml")
|
39
39
|
#Avery 7160 is found in avery-iso-templates
|
40
|
-
p =
|
40
|
+
p = Pdf::Label::Batch.new("Avery 7160")
|
41
41
|
assert p
|
42
42
|
assert_equal p.pdf.page_width, 595.28
|
43
43
|
assert_equal p.pdf.page_height, 841.89
|
44
|
-
|
44
|
+
Pdf::Label::Batch.load_template_set("#{ROOT}/templates/avery-us-templates.xml")
|
45
45
|
end
|
46
46
|
|
47
|
-
def
|
47
|
+
def test_PdfLabelBatch_all_template_names
|
48
48
|
#what happens if we havn't loaded a template yet?
|
49
|
-
t =
|
49
|
+
t = Pdf::Label::Batch.all_template_names
|
50
50
|
assert t
|
51
51
|
assert_equal t.class, Array
|
52
52
|
assert_equal t.size, 291
|
@@ -54,13 +54,13 @@ class TestPDFLabelPage < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
-
def
|
58
|
-
p =
|
57
|
+
def test_add_label_3_by_10
|
58
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 10
|
59
59
|
p.add_label() # should add to col 1, row 1
|
60
60
|
p.add_label(:position => 1) # should add col 1, row 2
|
61
61
|
p.add_label(:text => "Positoin 15", :position => 15) # should add col 2, row 1
|
62
62
|
#does the use_margin = true work?
|
63
|
-
p.add_label(:
|
63
|
+
p.add_label(:use_margin => true, :position => 4)
|
64
64
|
#with out the margin?
|
65
65
|
p.add_label(:text => 'No Margin', :position => 5, :use_margin => false)
|
66
66
|
p.add_label(:position => 7, :text => 'This is the song that never ends, yes it goes on and on my friends')
|
@@ -68,14 +68,32 @@ class TestPDFLabelPage < Test::Unit::TestCase
|
|
68
68
|
p.add_label(:text => "Centered", :position => 26, :justification => :center) # should add col 2, row 15
|
69
69
|
p.add_label(:text => "[Right justified]", :justification => :right, :position => 28)# col 2, row 14, right justified.
|
70
70
|
p.add_label(:position => 29) # should add col 2, row 15
|
71
|
-
p.add_label(:position => 8, :text => "This was added last and has a BIG font", :font_size =>
|
71
|
+
p.add_label(:position => 8, :text => "This was added last and has a BIG font", :font_size => 16)
|
72
|
+
p.add_label(:position => 8, :text => "This was added last and has a small font", :font_size => 8, :offset_y => -40)
|
72
73
|
p.draw_boxes(false, true)
|
73
74
|
#TODO Anybody out there think of a better way to test this?
|
74
75
|
p.save_as("#{ROOT}/test_add_label_output.pdf")
|
75
76
|
end
|
76
77
|
|
78
|
+
def test_add_label_3_by_10_multi_page
|
79
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 10
|
80
|
+
p.add_label() # should add to col 1, row 1
|
81
|
+
p.add_label(:position => 1) # should add col 1, row 2
|
82
|
+
p.add_label(:text => "Positoin 15", :position => 15) # should add col 2, row 1
|
83
|
+
#does the use_margin = true work?
|
84
|
+
p.add_label(:use_margin => true, :position => 4)
|
85
|
+
#with out the margin?
|
86
|
+
p.add_label(:text => 'No Margin', :position => 5, :use_margin => false)
|
87
|
+
p.add_label(:position => 48, :text => "This should be on a new page")
|
88
|
+
p.add_label(:position => 30, :text => "This should be first a page 2")
|
89
|
+
p.draw_boxes(false, true)
|
90
|
+
#TODO Anybody out there think of a better way to test this?
|
91
|
+
p.save_as("#{ROOT}/test_add_multi_page.pdf")
|
92
|
+
end
|
93
|
+
|
94
|
+
|
77
95
|
def test_add_many_labels
|
78
|
-
p =
|
96
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 10
|
79
97
|
#without positoin, so start at 1
|
80
98
|
p.add_many_labels(:text => "Hello Five Times!", :count => 5)
|
81
99
|
p.add_many_labels(:text => "Hellow four more times, starting at 15", :count => 4, :position => 15)
|
@@ -83,9 +101,49 @@ class TestPDFLabelPage < Test::Unit::TestCase
|
|
83
101
|
end
|
84
102
|
|
85
103
|
def test_draw_boxes
|
86
|
-
p =
|
104
|
+
p = Pdf::Label::Batch.new("Avery 5366") # label is 2 x 10
|
87
105
|
p.draw_boxes
|
88
106
|
p.save_as("#{ROOT}/test_draw_boxes_output.pdf")
|
89
107
|
end
|
108
|
+
|
109
|
+
def test_font_path
|
110
|
+
font_path = "#{ROOT}/fonts"
|
111
|
+
assert PDF::Writer::FontMetrics::METRICS_PATH.include?(font_path)
|
112
|
+
assert PDF::Writer::FONT_PATH.include?(font_path)
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_set_and_get_barcode_font
|
116
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 10
|
117
|
+
assert_equal "Code3de9.afm", p.barcode_font
|
118
|
+
|
119
|
+
assert p.barcode_font = "CodeDatamatrix.afm"
|
120
|
+
assert_equal "CodeDatamatrix.afm", p.barcode_font
|
121
|
+
|
122
|
+
assert_raise(RuntimeError) do
|
123
|
+
p.barcode_font = "CodeBob"
|
124
|
+
end
|
125
|
+
assert_equal "CodeDatamatrix.afm", p.barcode_font
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_add_barcode_label
|
130
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 2
|
131
|
+
i = 0
|
132
|
+
Pdf::Label::Batch.all_barcode_fonts.each_key do |font_name|
|
133
|
+
p.barcode_font = font_name
|
134
|
+
p.add_label(:text => font_name, :position => i)
|
135
|
+
i += 1
|
136
|
+
p.add_barcode_label(:bar_text => "Hello", :bar_size => 32, :text => "HELLO", :position => i)
|
137
|
+
i += 1
|
138
|
+
p.add_barcode_label(:text => "*1234567890*", :position => i, :bar_size => 32)
|
139
|
+
i += 1
|
140
|
+
end
|
141
|
+
p.save_as("#{ROOT}/test_barcode_output.pdf")
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_code39
|
145
|
+
p = Pdf::Label::Batch.new("Avery 8160") # label is 2 x 2
|
146
|
+
assert_equal "*HELLO123*", p.code39("hellO123")
|
147
|
+
end
|
90
148
|
|
91
149
|
end
|
data/vendor/pdf/writer.rb
CHANGED
@@ -841,6 +841,9 @@ class PDF::Writer
|
|
841
841
|
end
|
842
842
|
end
|
843
843
|
|
844
|
+
fbtype = fontfile
|
845
|
+
fbfile = fontfile
|
846
|
+
|
844
847
|
if font =~ /afm/o and fontfile
|
845
848
|
font_type = File.extname(fontfile)
|
846
849
|
|
@@ -853,7 +856,7 @@ class PDF::Writer
|
|
853
856
|
num = details["C"]
|
854
857
|
|
855
858
|
if num >= 0
|
856
|
-
warn "Multiple definitions of #{num}" if widths.has_key?(num)
|
859
|
+
#warn "Multiple definitions of #{num}" if widths.has_key?(num)
|
857
860
|
widths[num] = details['WX']
|
858
861
|
first_char = num if num < first_char or first_char < 0
|
859
862
|
last_char = num if num > last_char
|
@@ -35,14 +35,14 @@ class PDF::Writer::Object::Font < PDF::Writer::Object
|
|
35
35
|
@fontdescriptor = nil
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
attr_accessor :font_id
|
39
39
|
# The type of the font: Type1 and TrueType are the only values supported
|
40
40
|
# by
|
41
|
-
|
41
|
+
attr_accessor :subtype
|
42
42
|
# Valid values: WinAnsiEncoding, MacRomanEncoding, MacExpertEncoding,
|
43
43
|
# none, +nil+, or an instance of PDF::Writer::Object::FontEncoding.
|
44
|
-
|
45
|
-
|
44
|
+
attr_accessor :encoding
|
45
|
+
attr_accessor :basefont
|
46
46
|
def basefont #:nodoc:
|
47
47
|
@name
|
48
48
|
end
|
@@ -53,7 +53,7 @@
|
|
53
53
|
# are to them (and setting the direction would be fairly meaningless as
|
54
54
|
# none of these character sets are avaliable yet.
|
55
55
|
class PDF::Writer::Object::ViewerPreferences < PDF::Writer::Object
|
56
|
-
Preferences = %w{HideToolbar HideMenubar HideWindowUI FitWindow CenterWindow NonFullScreenPageMode Direction}
|
56
|
+
Preferences = %w{HideToolbar HideMenubar HideWindowUI FitWindow CenterWindow NonFullScreenPageMode PrintScaling Direction}
|
57
57
|
|
58
58
|
def initialize(parent)
|
59
59
|
super(parent)
|
@@ -69,6 +69,6 @@ class PDF::Writer::Object::ViewerPreferences < PDF::Writer::Object
|
|
69
69
|
v = __send__("#{s.downcase}".intern)
|
70
70
|
res << "\n/#{s} /#{v}" unless v.nil?
|
71
71
|
end
|
72
|
-
res << "\n>>\n"
|
72
|
+
res << "\n>>\nendobj\n"
|
73
73
|
end
|
74
74
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
diff -ur lib/pdf/writer/object/font.rb /usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer/object/font.rb
|
2
|
+
--- lib/pdf/writer/object/font.rb 2005-06-28 17:32:17.000000000 -0400
|
3
|
+
+++ /usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer/object/font.rb 2006-09-04 20:29:03.000000000 -0400
|
4
|
+
@@ -35,14 +35,14 @@
|
5
|
+
@fontdescriptor = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
- attr_reader :font_id
|
9
|
+
+ attr_accessor :font_id
|
10
|
+
# The type of the font: Type1 and TrueType are the only values supported
|
11
|
+
# by
|
12
|
+
- attr_reader :subtype
|
13
|
+
+ attr_accessor :subtype
|
14
|
+
# Valid values: WinAnsiEncoding, MacRomanEncoding, MacExpertEncoding,
|
15
|
+
# none, +nil+, or an instance of PDF::Writer::Object::FontEncoding.
|
16
|
+
- attr_reader :encoding
|
17
|
+
- attr_reader :basefont
|
18
|
+
+ attr_accessor :encoding
|
19
|
+
+ attr_accessor :basefont
|
20
|
+
def basefont #:nodoc:
|
21
|
+
@name
|
22
|
+
end
|
23
|
+
diff -ur lib/pdf/writer.rb /usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer.rb
|
24
|
+
--- lib/pdf/writer.rb 2005-09-07 13:01:14.000000000 -0400
|
25
|
+
+++ /usr/lib/ruby/gems/1.8/gems/pdf-writer-1.1.3/lib/pdf/writer.rb 2006-09-04 20:28:22.000000000 -0400
|
26
|
+
@@ -835,6 +835,9 @@
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
+ fbtype = fontfile
|
31
|
+
+ fbfile = fontfile
|
32
|
+
+
|
33
|
+
if font =~ /afm/o and fontfile
|
34
|
+
# Find the array of font widths, and put that into an object.
|
35
|
+
first_char = -1
|
metadata
CHANGED
@@ -1,50 +1,73 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4
|
3
|
-
specification_version: 1
|
4
2
|
name: pdf-labels
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version:
|
7
|
-
date: 2007-10-17 00:00:00 -07:00
|
8
|
-
summary: Easy label creation in Ruby through PDF::Writer and using templates from gLabels. Contains the library pdf_labels, the Rails engine LabelPageEngine and an example application FileClerk.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: rgkaufman@gmail.com
|
12
|
-
homepage:
|
13
|
-
rubyforge_project: pdf-labels
|
14
|
-
description: "== DESCRIPTION: Welcome to the PDF-Labels project. Our aim is to make creating labels programmatically easy in Ruby. This Library builds on top of \"PDF::Writer\":http://ruby-pdf.rubyforge.org/ and uses the templates from \"gLabels\":http://glabels.sourceforge.org. What this means is easy, clean Ruby code to create many common label types without measuring the labels yourself! All of this in pure Ruby (we use the XML templates from gLabels, we do NOT have a dependancy on gLabels, nor on Gnome) == FEATURES/PROBLEMS: * Works with all gLabels supported templates for rectangular labels * Does not yet work for CD labels (circles) == SYNOPSIS: p = PDFLabelPage.new(\"Avery 8160\") # label is 2 x 10 #Some examples of adding labels p.add_label() # should add to col 1, row 1 p.add_label(:position => 1) # should add col 1, row 2 p.add_label(:text => \"Positoin 15\", :position => 15) # should add col 2, row 1 p.add_label(:text => 'No Margin', :position => 5, :use_margin => false) #this doesn't use a margin p.add_label(:position => 9, :text => \"X Offset = 4, Y Offset = -6\", :offset_x => 4, :offset_y => -6) p.add_label(:text => \"Centered\", :position => 26, :justification => :center) # should add col 2, row 15 p.add_label(:text => \"[Right justified]\", :justification => :right, :position => 28)# col 2, row 14, right justified. p.add_label(:position => 29) # should add col 2, row 15 p.add_label(:position => 8, :text => \"This was added last and has a BIG font\", :font_size => 18)"
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: true
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
4
|
+
version: 2.0.1
|
25
5
|
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
29
6
|
authors:
|
30
7
|
- Rob Kaufman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-08-30 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.7.0
|
24
|
+
version:
|
25
|
+
description: "== DESCRIPTION: Welcome to the PDF-Labels project. Our aim is to make creating labels programmatically easy in Ruby. This Library builds on top of \"PDF::Writer\":http://ruby-pdf.rubyforge.org/ and uses the templates from \"gLabels\":http://glabels.sourceforge.org. What this means is easy, clean Ruby code to create many common label types without measuring the labels yourself! All of this in pure Ruby (we use the XML templates from gLabels, we do NOT have a dependancy on gLabels, nor on Gnome) == FEATURES/PROBLEMS: * Works with all gLabels supported templates for rectangular labels * Does not yet work for CD labels (circles) == SYNOPSIS: p = PDFLabelPage.new(\"Avery 8160\") # label is 2 x 10 #Some examples of adding labels p.add_label() # should add to col 1, row 1 p.add_label(:position => 1) # should add col 1, row 2 p.add_label(:text => \"Positoin 15\", :position => 15) # should add col 2, row 1 p.add_label(:text => 'No Margin', :position => 5, :use_margin => false) #this doesn't use a margin p.add_label(:position => 9, :text => \"X Offset = 4, Y Offset = -6\", :offset_x => 4, :offset_y => -6) p.add_label(:text => \"Centered\", :position => 26, :justification => :center) # should add col 2, row 15 p.add_label(:text => \"[Right justified]\", :justification => :right, :position => 28)# col 2, row 14, right justified. p.add_label(:position => 29) # should add col 2, row 15 p.add_label(:position => 8, :text => \"This was added last and has a BIG font\", :font_size => 18)"
|
26
|
+
email: rgkaufman@gmail.com
|
27
|
+
executables: []
|
28
|
+
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- pdf-labels-patch-to-r62.txt
|
35
|
+
- README.txt
|
31
36
|
files:
|
37
|
+
- fonts/Code128.afm
|
38
|
+
- fonts/Code128.pfb
|
39
|
+
- fonts/Code128.ttf
|
40
|
+
- fonts/Code2of5interleaved.afm
|
41
|
+
- fonts/Code2of5interleaved.pfb
|
42
|
+
- fonts/Code2of5interleaved.ttf
|
43
|
+
- fonts/Code3de9.afm
|
44
|
+
- fonts/Code3de9.pfb
|
45
|
+
- fonts/Code3de9.ttf
|
46
|
+
- fonts/CodeDatamatrix.afm
|
47
|
+
- fonts/CodeDatamatrix.pfb
|
48
|
+
- fonts/CodeDatamatrix.ttf
|
49
|
+
- fonts/CodeEAN13.afm
|
50
|
+
- fonts/CodeEAN13.pfb
|
51
|
+
- fonts/CodeEAN13.ttf
|
52
|
+
- fonts/CodePDF417.afm
|
53
|
+
- fonts/CodePDF417.pfb
|
54
|
+
- fonts/CodePDF417.ttf
|
32
55
|
- History.txt
|
33
|
-
-
|
34
|
-
- lib/alias.rb
|
35
|
-
- lib/
|
36
|
-
- lib/label.rb
|
37
|
-
- lib/
|
38
|
-
- lib/
|
39
|
-
- lib/
|
40
|
-
- lib/
|
41
|
-
- lib/
|
42
|
-
- lib/
|
56
|
+
- init.rb
|
57
|
+
- lib/pdf/label/alias.rb
|
58
|
+
- lib/pdf/label/batch.rb
|
59
|
+
- lib/pdf/label/glabel_template.rb
|
60
|
+
- lib/pdf/label/label.rb
|
61
|
+
- lib/pdf/label/layout.rb
|
62
|
+
- lib/pdf/label/length_node.rb
|
63
|
+
- lib/pdf/label/markup.rb
|
64
|
+
- lib/pdf/label/template.rb
|
65
|
+
- lib/pdf/label.rb
|
43
66
|
- LICENCE
|
44
67
|
- Manifest.txt
|
68
|
+
- pdf-labels-patch-to-r62.txt
|
45
69
|
- Rakefile
|
46
70
|
- README.txt
|
47
|
-
- templates
|
48
71
|
- templates/avery-iso-templates.xml
|
49
72
|
- templates/avery-other-templates.xml
|
50
73
|
- templates/avery-us-templates.xml
|
@@ -54,39 +77,29 @@ files:
|
|
54
77
|
- templates/misc-us-templates.xml
|
55
78
|
- templates/paper-sizes.xml
|
56
79
|
- templates/zweckform-iso-templates.xml
|
57
|
-
- test
|
58
80
|
- test/test_pdf_label_page.rb
|
59
|
-
- vendor
|
60
|
-
- vendor/color
|
61
81
|
- vendor/color/cmyk.rb
|
62
82
|
- vendor/color/css.rb
|
63
83
|
- vendor/color/grayscale.rb
|
64
84
|
- vendor/color/hsl.rb
|
65
|
-
- vendor/color/palette
|
66
85
|
- vendor/color/palette/gimp.rb
|
67
86
|
- vendor/color/palette/monocontrast.rb
|
68
87
|
- vendor/color/palette.rb
|
69
|
-
- vendor/color/rgb
|
70
88
|
- vendor/color/rgb/metallic.rb
|
71
89
|
- vendor/color/rgb-colors.rb
|
72
90
|
- vendor/color/rgb.rb
|
73
91
|
- vendor/color/yiq.rb
|
74
92
|
- vendor/color.rb
|
75
|
-
- vendor/pdf
|
76
|
-
- vendor/pdf/charts
|
77
93
|
- vendor/pdf/charts/stddev.rb
|
78
94
|
- vendor/pdf/charts.rb
|
79
|
-
- vendor/pdf/fonts
|
80
95
|
- vendor/pdf/grid.rb
|
81
96
|
- vendor/pdf/math.rb
|
82
97
|
- vendor/pdf/pagenumbers.rb
|
83
98
|
- vendor/pdf/quickref.rb
|
84
99
|
- vendor/pdf/simpletable.rb
|
85
100
|
- vendor/pdf/techbook.rb
|
86
|
-
- vendor/pdf/writer
|
87
101
|
- vendor/pdf/writer/arc4.rb
|
88
102
|
- vendor/pdf/writer/fontmetrics.rb
|
89
|
-
- vendor/pdf/writer/fonts
|
90
103
|
- vendor/pdf/writer/fonts/Courier-Bold.afm
|
91
104
|
- vendor/pdf/writer/fonts/Courier-BoldOblique.afm
|
92
105
|
- vendor/pdf/writer/fonts/Courier-Oblique.afm
|
@@ -101,13 +114,10 @@ files:
|
|
101
114
|
- vendor/pdf/writer/fonts/Times-Italic.afm
|
102
115
|
- vendor/pdf/writer/fonts/Times-Roman.afm
|
103
116
|
- vendor/pdf/writer/fonts/ZapfDingbats.afm
|
104
|
-
- vendor/pdf/writer/graphics
|
105
117
|
- vendor/pdf/writer/graphics/imageinfo.rb
|
106
118
|
- vendor/pdf/writer/graphics.rb
|
107
|
-
- vendor/pdf/writer/lang
|
108
119
|
- vendor/pdf/writer/lang/en.rb
|
109
120
|
- vendor/pdf/writer/lang.rb
|
110
|
-
- vendor/pdf/writer/object
|
111
121
|
- vendor/pdf/writer/object/action.rb
|
112
122
|
- vendor/pdf/writer/object/annotation.rb
|
113
123
|
- vendor/pdf/writer/object/catalog.rb
|
@@ -131,36 +141,44 @@ files:
|
|
131
141
|
- vendor/pdf/writer/state.rb
|
132
142
|
- vendor/pdf/writer/strokestyle.rb
|
133
143
|
- vendor/pdf/writer.rb
|
134
|
-
- vendor/
|
135
|
-
- vendor/transaction/simple
|
144
|
+
- vendor/pdf_writer_font_patch.diff
|
136
145
|
- vendor/transaction/simple/group.rb
|
137
|
-
- vendor/transaction/simple/threadsafe
|
138
146
|
- vendor/transaction/simple/threadsafe/group.rb
|
139
147
|
- vendor/transaction/simple/threadsafe.rb
|
140
148
|
- vendor/transaction/simple.rb
|
141
|
-
- vendor/xml
|
142
149
|
- vendor/xml/LICENSE
|
143
|
-
- vendor/xml/mapping
|
144
150
|
- vendor/xml/mapping/base.rb
|
145
151
|
- vendor/xml/mapping/standard_nodes.rb
|
146
152
|
- vendor/xml/mapping/version.rb
|
147
153
|
- vendor/xml/mapping.rb
|
148
|
-
- vendor/xml/xxpath.rb
|
149
154
|
- vendor/xml/README
|
150
|
-
|
151
|
-
|
155
|
+
- vendor/xml/xxpath.rb
|
156
|
+
has_rdoc: true
|
157
|
+
homepage:
|
158
|
+
post_install_message:
|
152
159
|
rdoc_options:
|
153
160
|
- --main
|
154
161
|
- README.txt
|
155
|
-
|
156
|
-
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
162
|
+
require_paths:
|
163
|
+
- lib
|
164
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: "0"
|
169
|
+
version:
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: "0"
|
175
|
+
version:
|
163
176
|
requirements: []
|
164
177
|
|
165
|
-
|
166
|
-
|
178
|
+
rubyforge_project: pdf-labels
|
179
|
+
rubygems_version: 1.2.0
|
180
|
+
signing_key:
|
181
|
+
specification_version: 2
|
182
|
+
summary: Easy label creation in Ruby through PDF::Writer and using templates from gLabels. Contains the library pdf_labels, the Rails engine LabelPageEngine and an example application FileClerk.
|
183
|
+
test_files:
|
184
|
+
- test/test_pdf_label_page.rb
|