pdf_gen 0.7
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/LICENSE +19 -0
- data/README.rdoc +189 -0
- data/lib/base_region.rb +95 -0
- data/lib/caption.rb +78 -0
- data/lib/containers/caption_container.rb +15 -0
- data/lib/containers/div_container.rb +14 -0
- data/lib/containers/image_container.rb +15 -0
- data/lib/containers/span_container.rb +14 -0
- data/lib/containers/table_container.rb +14 -0
- data/lib/data/ds_ar.rb +31 -0
- data/lib/data/ds_base.rb +24 -0
- data/lib/data/ds_hash.rb +24 -0
- data/lib/div.rb +148 -0
- data/lib/document.rb +50 -0
- data/lib/fixnum.rb +18 -0
- data/lib/float.rb +18 -0
- data/lib/image.rb +46 -0
- data/lib/modules/base_attributes.rb +86 -0
- data/lib/modules/canvas.rb +15 -0
- data/lib/modules/composite.rb +54 -0
- data/lib/pdf_gen.rb +30 -0
- data/lib/smart_table.rb +155 -0
- data/lib/span.rb +69 -0
- data/lib/table.rb +116 -0
- data/lib/writer.rb +30 -0
- data/samples/border.rb +15 -0
- data/samples/div.rb +23 -0
- data/samples/div_illustration.rb +64 -0
- data/samples/headerfooter.rb +94 -0
- data/samples/image.rb +9 -0
- data/samples/ruby_logo.jpg +0 -0
- data/samples/sampl1_1.png +0 -0
- data/samples/sampl1_2.png +0 -0
- data/samples/sampl1_3.png +0 -0
- data/samples/simple.rb +7 -0
- data/samples/smart_table.rb +98 -0
- data/samples/span.rb +12 -0
- data/samples/span_illustration.rb +41 -0
- data/samples/spanindiv_ill.rb +53 -0
- data/samples/table.rb +37 -0
- data/samples/table_illustration.rb +177 -0
- data/samples/tableindiv_ill.rb +99 -0
- data/test/caption_test.rb +99 -0
- data/test/container_test.rb +29 -0
- data/test/div_test.rb +39 -0
- data/test/helpers_for_testing.rb +19 -0
- data/test/image_test.rb +54 -0
- data/test/shared_examples.rb +68 -0
- data/test/span_test.rb +83 -0
- data/test/table_test.rb +27 -0
- metadata +139 -0
data/samples/div.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
image_data = open(File.expand_path('ruby_logo.jpg'), "rb") { |file| file.read }
|
6
|
+
|
7
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
8
|
+
div :width => 12.cm do
|
9
|
+
span :paddings => 0.5.cm, :border => true do
|
10
|
+
image image_data, :width => 5.cm
|
11
|
+
caption ' first '*50, :width => 3.cm
|
12
|
+
caption ' second '*100, :width => 4.cm
|
13
|
+
end
|
14
|
+
span :paddings => 0.5.cm, :border => true do
|
15
|
+
image image_data, :width => 5.cm
|
16
|
+
caption ' first '*50, :width => 3.cm
|
17
|
+
caption ' second '*50, :width => 3.cm
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
23
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
long_text = <<TEXT
|
5
|
+
A Software Requirements Specification (SRS) - a requirements
|
6
|
+
specification for a software system - is a complete description of the behavior
|
7
|
+
of a system to be developed. It includes a set of use cases that describe all
|
8
|
+
the interactions the users will have with the software.
|
9
|
+
Use cases are also known as functional requirements.
|
10
|
+
In addition to use cases, the SRS also contains non-functional
|
11
|
+
(or supplementary) requirements. Non-functional requirements are requirements
|
12
|
+
which impose constraints on the design or implementation
|
13
|
+
(such as performance engineering requirements, quality standards,
|
14
|
+
or design constraints).
|
15
|
+
TEXT
|
16
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
17
|
+
caption ' Software Requirements Specification ', :text_color => Color::RGB::Grey,
|
18
|
+
:font_size => 16, :bold => true, :justification => :center
|
19
|
+
|
20
|
+
caption long_text,
|
21
|
+
:text_color => Color::RGB::Grey, :font_size => 12, :justification => :left
|
22
|
+
|
23
|
+
div :width => 18.cm, :horizontal_interval => 1.cm do
|
24
|
+
|
25
|
+
span :pad_left => 2.cm do
|
26
|
+
caption '1', :width => 2.cm
|
27
|
+
caption 'INTRODUCTION', :width => 12.cm
|
28
|
+
end
|
29
|
+
span :width => 16.cm, :pad_left => 2.5.cm do
|
30
|
+
caption '1.1', :width => 2.cm
|
31
|
+
caption 'Product Overview', :width => 10.cm
|
32
|
+
end
|
33
|
+
span :width => 16.cm, :pad_left => 2.5.cm do
|
34
|
+
caption '1.2', :width => 2.cm
|
35
|
+
caption 'Purpose', :width => 10.cm
|
36
|
+
end
|
37
|
+
span :width => 16.cm, :pad_left => 2.5.cm do
|
38
|
+
caption '1.3', :width => 2.cm
|
39
|
+
caption 'Scope', :width => 10.cm
|
40
|
+
end
|
41
|
+
span :width => 16.cm, :pad_left => 2.5.cm do
|
42
|
+
caption '1.4', :width => 2.cm
|
43
|
+
caption 'Reference', :width => 10.cm
|
44
|
+
end
|
45
|
+
span :width => 16.cm, :pad_left => 2.5.cm do
|
46
|
+
caption '1.4', :width => 2.cm
|
47
|
+
caption 'Definitions and Abbreviations', :width => 10.cm
|
48
|
+
end
|
49
|
+
span :pad_left => 2.cm do
|
50
|
+
caption '2', :width => 2.cm
|
51
|
+
caption 'OVERALL DESCRIPTION', :width => 12.cm
|
52
|
+
end
|
53
|
+
span :width => 18.cm, :pad_left => 2.cm do
|
54
|
+
caption '3', :width => 2.cm
|
55
|
+
caption 'SPECIFIC REQUIREMENTS', :width => 12.cm
|
56
|
+
end
|
57
|
+
span :width => 18.cm, :pad_left => 2.cm do
|
58
|
+
caption '4', :width => 2.cm
|
59
|
+
caption 'ADDITIONAL MATERIALS', :width => 12.cm
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
64
|
+
|
@@ -0,0 +1,94 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 1.cm do
|
6
|
+
div :paddings => 1.cm do
|
7
|
+
table do
|
8
|
+
title do
|
9
|
+
caption "02.11.2010",
|
10
|
+
:text_color => Color::RGB::Green, :justification => :center
|
11
|
+
end
|
12
|
+
|
13
|
+
header do
|
14
|
+
span do
|
15
|
+
caption "This paper, copyright the IEEE, appears in IEEE Symposium on Security and Privacy 2004. IEEE Computer
|
16
|
+
Society Press, May 2004. This paper previously appeared as Johns Hopkins University Information Security
|
17
|
+
Institute Technical Report TR-2003-19, July 23, 2003.",
|
18
|
+
:width => av_width, :justification => :center, :pad_bottom => 2.5.cm,
|
19
|
+
:border => true, :border_bottom => false, :font_size => 9
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
body do
|
24
|
+
span do
|
25
|
+
caption "Analysis of an Electronic Voting System ",
|
26
|
+
:justification => :center, :pad_bottom => 1.0.cm, :border_right => true,
|
27
|
+
:border_left => true, :pad_bottom => 2, :font_size => 16
|
28
|
+
end
|
29
|
+
|
30
|
+
span do
|
31
|
+
caption "TADAYOSHI KOHNO",
|
32
|
+
:width => av_width / 3, :justification => :center,
|
33
|
+
:border => true
|
34
|
+
caption "ADAM STUBBLEFIELD",
|
35
|
+
:width => av_width / 3, :justification => :center,
|
36
|
+
:border => true
|
37
|
+
caption "DAN S. WALLACH",
|
38
|
+
:width => av_width / 3, :justification => :center,
|
39
|
+
:border => true
|
40
|
+
end
|
41
|
+
|
42
|
+
span do
|
43
|
+
caption " With significant U.S. federal funds now available to replace outdated punch-card and mechanical
|
44
|
+
voting systems, municipalities and states throughout the U.S. are adopting paperless electronic voting
|
45
|
+
systems from a number of different vendors. We present a security analysis of the source code to one such
|
46
|
+
machine used in a significant share of the market. Our analysis shows that this voting system is far below
|
47
|
+
even the most minimal security standards applicable in other contexts. We identify several problems
|
48
|
+
including unauthorized privilege escalation, incorrect use of cryptography, vulnerabilities to network
|
49
|
+
threats, and poor software development processes. We show that voters, without any insider privileges,
|
50
|
+
can cast unlimited votes without being detected by any mechanisms within the voting terminal software.
|
51
|
+
Furthermore, we show that even the most serious of our outsider attacks could have been discovered
|
52
|
+
and executed without access to the source code. In the face of such attacks, the usual worries about
|
53
|
+
insider threats are not the only concerns; outsiders can do the damage. That said, we demonstrate that
|
54
|
+
the insider threat is also quite considerable, showing that not only can an insider, such as a poll worker,
|
55
|
+
modify the votes, but that insiders can also violate voter privacy and match votes with the voters who
|
56
|
+
cast them. We conclude that this voting system is unsuitable for use in a general election. Any paperless
|
57
|
+
electronic voting system might suffer similar flaws, despite any certification it could have otherwise
|
58
|
+
received. We suggest that the best solutions are voting systems having a voter-verifiable audit trail,
|
59
|
+
where a computerized voting system might print a paper ballot that can be read and verified by the voter. ",
|
60
|
+
|
61
|
+
:justification => :left, :font_size => 12, :border => true
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
footer do
|
68
|
+
span do
|
69
|
+
caption "Dept. of Computer Science and Engineering, University
|
70
|
+
of California at San Diego, 9500 Gilman Drive, La Jolla, California 92093,
|
71
|
+
USA. E-mail: tkohno@cs.ucsd.edu. URL: http://www-cse.ucsd.edu/users/tkohno.
|
72
|
+
Most of this work was performed while visiting the Johns Hopkins University
|
73
|
+
Information Security Institute. Supported by a National Defense Science and
|
74
|
+
Engineering Graduate Fellowship. ",
|
75
|
+
:width => av_width / 3, :justification => :center,
|
76
|
+
:border_top => true,
|
77
|
+
:pad_bottom => 2, :font_size => 9
|
78
|
+
|
79
|
+
caption "Information Security Institute, Johns Hopkins University,
|
80
|
+
3400 North Charles Street, Baltimore, Maryland 21218, USA.
|
81
|
+
E-mail: astubble@cs.jhu.edu. URL: http://spar.isi.jhu.edu/.astubble.",
|
82
|
+
:width => av_width / 3, :justification => :center,
|
83
|
+
:border_top => true, :font_size => 9
|
84
|
+
|
85
|
+
caption "IInformation Security Institute, Johns Hopkins University,
|
86
|
+
3400 North Charles Street, Baltimore, Maryland 21218, USA. E-mail: rubin@cs.jhu.edu.
|
87
|
+
URL: http://www.avirubin.com.",
|
88
|
+
:width => av_width / 3, :justification => :center,
|
89
|
+
:border_top => true, :font_size => 9
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
data/samples/image.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
6
|
+
image_data = open(File.expand_path('ruby_logo.jpg'), "rb") { |file| file.read }
|
7
|
+
image image_data, :width => 250
|
8
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
9
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/samples/simple.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
table_data = {:columns => ['Software requirements', 'Software design',
|
6
|
+
'Software contractions', 'Software Testing', 'Software maintenance'],
|
7
|
+
|
8
|
+
:body => [["Requirements fundamentals", "Design fundamentals",
|
9
|
+
"Software contractions fundamentals", "Software testing fundamentals",
|
10
|
+
"Software maintenance fundamentals"],
|
11
|
+
["Requirements process", "Key issues in software design",
|
12
|
+
"Managing constructions", "Test levels", "Key issues in software maintenance"],
|
13
|
+
["Requirements ellocation", "Software structure and architecture",
|
14
|
+
"Practical considerations", "Test techniques", "Maintenance process"],
|
15
|
+
["Requirements analyses", "Design quality analyses and evaluation", " ",
|
16
|
+
"Test related messures", "Techniques for maintenance"],
|
17
|
+
["Requirements specification", "Design notations", " ", "Test processes",
|
18
|
+
" "],
|
19
|
+
["Requirements validation", "Design strategy and methods", " ", " ", " "]] }
|
20
|
+
|
21
|
+
|
22
|
+
PDFGen::document PDF::Writer.new, 0.5.cm do
|
23
|
+
|
24
|
+
div :horizontal_interval => 1.cm,
|
25
|
+
:pad_left => 1.cm, :pad_right => 1.cm do
|
26
|
+
|
27
|
+
|
28
|
+
table :data_source => table_data, :repeat_header_on_each_page => true do
|
29
|
+
|
30
|
+
title do
|
31
|
+
span :pad_top => 1.cm, :pad_bottom => 1.cm do
|
32
|
+
caption "SWEBOK STRUCTURE, main processes", :width => av_width * 3/7,
|
33
|
+
:justification => :center,
|
34
|
+
:pad_top => 1.05.cm, :pad_bottom => 1.cm, :font_size => 22,
|
35
|
+
:text_color => Color::RGB::Green
|
36
|
+
div :width => av_width * 4/7, :background_color => Color::RGB::LightGrey,
|
37
|
+
:border => true, :border_width => 2, :border_color => Color::RGB::Green do
|
38
|
+
|
39
|
+
caption "IEEE",
|
40
|
+
:justification => :center, :pad_top => 1.cm,
|
41
|
+
:font_size => 24, :text_color => Color::RGB::DarkGrey
|
42
|
+
caption "Computer Society",
|
43
|
+
:justification => :center, :pad_top => 1.cm, :font_size => 20,
|
44
|
+
:text_color => Color::RGB::White
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
header do
|
51
|
+
row do
|
52
|
+
cell ds.columns[0], :justification => :center, :font_size => 14, :text_color => Color::RGB::Grey
|
53
|
+
cell ds.columns[1], :justification => :center,
|
54
|
+
:font_size => 14, :text_color => Color::RGB::Grey
|
55
|
+
cell ds.columns[2], :justification => :center,
|
56
|
+
:font_size => 14, :text_color => Color::RGB::Grey
|
57
|
+
cell ds.columns[3], :justification => :center,
|
58
|
+
:font_size => 14, :text_color => Color::RGB::Grey
|
59
|
+
cell ds.columns[4], :justification => :center,
|
60
|
+
:font_size => 14, :text_color => Color::RGB::Grey
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
body do
|
65
|
+
|
66
|
+
ds.each do |datarow|
|
67
|
+
row do
|
68
|
+
cell datarow[0], :justification => :center,
|
69
|
+
:border_right => true
|
70
|
+
cell datarow[1], :justification => :center,
|
71
|
+
:border_right => true
|
72
|
+
cell datarow[2], :justification => :center,
|
73
|
+
:border_right => true
|
74
|
+
cell datarow[3], :justification => :center,
|
75
|
+
:border_right => true
|
76
|
+
cell datarow[4], :justification => :center
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
footer do
|
82
|
+
span :background_color => Color::RGB::LightGrey do
|
83
|
+
caption "About Us: Mission, Vision & Goals, History Awards Program Volunteer Leadership Staff Leadership Nondiscrimination Policy"
|
84
|
+
caption "Contact Us: Customer Service, Key Staff Contacts Advertising Office Locations & Directions Report Website Issue"
|
85
|
+
caption "Member Resources: Renew Membership Access e-Learning Courses Access Safari Books Online Access Books 24x7 Discounted Subscriptions Discounted Conference Registration Chapter Contacts
|
86
|
+
Username / Password Issues"
|
87
|
+
caption "Volunteer Center: Member & Geographic Activities Educational Activities Professional Activities"
|
88
|
+
caption "For More Information: Press Room Member Resource Guide (PDF) Author Information Request Information"
|
89
|
+
elements :justification => :center, :font_size => 7, :text_color => Color::RGB::White, :width => av_width/5
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
97
|
+
|
98
|
+
|
data/samples/span.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
6
|
+
span :width => 10.cm, :pad_left => 2.cm do
|
7
|
+
caption ' first '*50, :width => 4.cm
|
8
|
+
caption ' second '*50, :width => 4.cm
|
9
|
+
elements :border => true #group set params
|
10
|
+
end
|
11
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
12
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
image_data = open(File.expand_path('sampl1_2.png'), "rb") { |file| file.read }
|
5
|
+
image_data1 = open(File.expand_path('sampl1_3.png'), "rb") { |file| file.read }
|
6
|
+
|
7
|
+
PDFGen::document PDF::Writer.new, 1.cm do
|
8
|
+
caption ' Mixed Integer Linear Programming: ',
|
9
|
+
:paddings => 1.5.cm, :text_color => Color::RGB::Grey, :justification => :center, :font_size => 20
|
10
|
+
|
11
|
+
caption ' Branch and Bound: ', :paddings => 1.5.cm,
|
12
|
+
:text_color => Color::RGB::Red, :justification => :center, :font_size => 20
|
13
|
+
|
14
|
+
div :pad_left => 0.5.cm, :pad_right => 0.5.cm do
|
15
|
+
|
16
|
+
span :border => true, :border_color => Color::RGB::Red, :paddings => 1 do
|
17
|
+
image image_data, :width => 10.cm, :border_right => true, :border_color => Color::RGB::Grey
|
18
|
+
|
19
|
+
caption ' Branch and Bound - implicit enumeration solve relaxed LP problem with additional
|
20
|
+
bounds for integer variables ', :width => 10.cm, :font_size => 12, :justification => :center
|
21
|
+
end
|
22
|
+
|
23
|
+
caption ' Branch and Cut: ', :paddings => 1.cm, :text_color => Color::RGB::Red, :justification => :center,
|
24
|
+
:font_size => 20
|
25
|
+
|
26
|
+
span :border => true,
|
27
|
+
:border_style => :dotted, :border_width => 0.05.cm, :border_color => Color::RGB::Red do
|
28
|
+
|
29
|
+
caption ' Branch and Cut solve relaxed LP problem with additional valid constraints B&B
|
30
|
+
is a proof techniques', :width => 10.cm, :paddings => 1.cm, :border_width => 0.2.cm,
|
31
|
+
:border_color => Color::RGB::Grey,
|
32
|
+
:font_size => 12, :justification => :center
|
33
|
+
|
34
|
+
|
35
|
+
image image_data1, :width => 10.cm, :pad_left => 0.7.cm, :pad_right => 0.7.cm,
|
36
|
+
:pad_top => 0.3.cm, :pad_bottom => 0.3.cm, :border_left => true,
|
37
|
+
:border_color => Color::RGB::Grey
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
@@ -0,0 +1,53 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
6
|
+
div :pad_right => 1 do
|
7
|
+
div :horizontal_interval => 1.0.cm,:paddings => 1.cm, :border => true, :border_style => :dotted, :border_width => 1.5 do
|
8
|
+
|
9
|
+
caption 'Introduction: Models, Model Building and Mathematical Optimization', :width => 20.cm,
|
10
|
+
:pad_top => 1.cm, :pad_bottom => 1.cm,
|
11
|
+
:border => true, :border_width => 0.02.cm, :background_color => Color::RGB::Grey,
|
12
|
+
:text_color => Color:: RGB::White, :font_size => 18, :bold => true, :justification => :center
|
13
|
+
|
14
|
+
caption 'The Importance of Modeling Langauges for Solving Real World Problems', :width => 20.cm,
|
15
|
+
:pad_top => 1.cm, :pad_bottom => 1.cm,
|
16
|
+
:border => true, :border_width => 0.02.cm,
|
17
|
+
:background_color => Color::RGB::LightGrey, :text_color => Color::RGB::White, :font_size => 16,
|
18
|
+
:bold => true, :justification => :center
|
19
|
+
elements :border_color => Color::RGB::Grey
|
20
|
+
|
21
|
+
caption 'Josef Kallrath', :width => 20.cm,
|
22
|
+
:pad_left => 1.cm, :pad_right => 1.cm, :pad_top => 0.cm, :pad_bottom => 0.cm,
|
23
|
+
:text_color => Color::RGB::LightBlue, :font_size => 22, :justification => :center
|
24
|
+
|
25
|
+
caption 'Structure of the Lecture: ', :width => 20.cm,
|
26
|
+
:text_color => Color::RGB::Red, :justification => :center, :font_size => 20
|
27
|
+
|
28
|
+
span :width => 20.cm, :pad_left => 0.05.cm, :border => true, :border_width => 0.05.cm, :border_color => Color::RGB::Red,
|
29
|
+
:background_color => Color::RGB::LightPink do
|
30
|
+
|
31
|
+
image_data = open(File.expand_path('sampl1_1.png'), "rb") { |file| file.read }
|
32
|
+
image image_data, :paddings => 0.2.cm, :width => 7.5.cm
|
33
|
+
|
34
|
+
div :width => 11.5.cm, :horizontal_interval => 0.1.cm do
|
35
|
+
caption ' * the Modeling Process, ', :justification => :left,
|
36
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
37
|
+
caption ' * survey of Real World Problems, ',:justification => :left,
|
38
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
39
|
+
caption ' * mathematical background (solution algorithms), ',:justification => :left,
|
40
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
41
|
+
caption ' * efficient problem solving & good modeling practice, ', :justification => :left,
|
42
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
43
|
+
caption ' * mathematical modeling & optimization in practice, ',:justification => :left,
|
44
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
45
|
+
caption ' * practioners`s requirements towards modeling languages ', :justification => :left,
|
46
|
+
:text_color => Color::RGB::Grey, :font_size => 12
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
caption '- 45 -', :justification => :center
|
52
|
+
end
|
53
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
data/samples/table.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
image_data = open(File.expand_path('ruby_logo.jpg'), "rb") { |file| file.read }
|
5
|
+
|
6
|
+
PDFGen::document PDF::Writer.new, 2.cm do
|
7
|
+
div :paddings => 15 do
|
8
|
+
table do
|
9
|
+
title do
|
10
|
+
caption "<i>Table 1.1.</i> <b>Users</b>", :pad_bottom => 1
|
11
|
+
end
|
12
|
+
header do
|
13
|
+
span do
|
14
|
+
caption "name", :width => av_width/3
|
15
|
+
caption "Last name", :width => av_width/3
|
16
|
+
caption "Email", :width => av_width/3
|
17
|
+
elements :border => true, :paddings => 1, :justification => :center
|
18
|
+
end
|
19
|
+
end
|
20
|
+
body do
|
21
|
+
span do
|
22
|
+
caption "Valeriy", :width => av_width/3
|
23
|
+
caption "Sizov", :width => av_width/3
|
24
|
+
caption "example@gmail.com", :width => av_width/3
|
25
|
+
elements :border => true, :paddings => 1
|
26
|
+
end
|
27
|
+
span do
|
28
|
+
caption "Dmitriy", :width => av_width/3
|
29
|
+
caption "Landberg", :width => av_width/3
|
30
|
+
caption "example1@gmail.com", :width => av_width/3
|
31
|
+
elements :border => true, :paddings => 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
37
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 1.cm do
|
6
|
+
div :paddings => 5 do
|
7
|
+
table do
|
8
|
+
title do
|
9
|
+
caption "Financial Report", :text_color => Color::RGB::Green,
|
10
|
+
:border => true, :font_size => 16, :justification => :center
|
11
|
+
end
|
12
|
+
|
13
|
+
header do
|
14
|
+
span do
|
15
|
+
caption "Characteristic",
|
16
|
+
:width => av_width / 8, :justification => :center,
|
17
|
+
:border => true, :font_size => 9
|
18
|
+
|
19
|
+
caption "2005",
|
20
|
+
:width => av_width / 8, :justification => :center,
|
21
|
+
:border => true, :font_size => 9
|
22
|
+
|
23
|
+
caption "2006",
|
24
|
+
:width => av_width / 8, :justification => :center,
|
25
|
+
:border => true, :font_size => 9
|
26
|
+
|
27
|
+
caption "2007",
|
28
|
+
:width => av_width / 8, :justification => :center,
|
29
|
+
:border => true, :font_size => 9
|
30
|
+
|
31
|
+
caption "2008",
|
32
|
+
:width => av_width / 8, :justification => :center,
|
33
|
+
:border => true, :font_size => 9
|
34
|
+
|
35
|
+
caption "2009",
|
36
|
+
:width => av_width / 8, :justification => :center,
|
37
|
+
:border => true, :font_size => 9
|
38
|
+
|
39
|
+
caption "2010",
|
40
|
+
:width => av_width / 8, :justification => :center,
|
41
|
+
:border => true, :font_size => 9
|
42
|
+
|
43
|
+
caption "2011",
|
44
|
+
:width => av_width / 8, :justification => :center,
|
45
|
+
:border => true, :font_size => 9
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
body do
|
50
|
+
span do
|
51
|
+
caption "Profit",
|
52
|
+
:width => av_width / 8, :justification => :center,
|
53
|
+
:border => true, :font_size => 12
|
54
|
+
|
55
|
+
caption "1000",
|
56
|
+
:width => av_width / 8, :justification => :center,
|
57
|
+
:border => true, :font_size => 12
|
58
|
+
caption "1000",
|
59
|
+
:width => av_width / 8, :justification => :center,
|
60
|
+
:border => true, :font_size => 12
|
61
|
+
caption "1000",
|
62
|
+
:width => av_width / 8, :justification => :center,
|
63
|
+
:border => true, :font_size => 12
|
64
|
+
caption "1000",
|
65
|
+
:width => av_width / 8, :justification => :center,
|
66
|
+
:border => true, :font_size => 12
|
67
|
+
caption "1000",
|
68
|
+
:width => av_width / 8, :justification => :center,
|
69
|
+
:border => true, :font_size => 12
|
70
|
+
caption "1000",
|
71
|
+
:width => av_width / 8, :justification => :center,
|
72
|
+
:border => true, :font_size => 12
|
73
|
+
caption "1000",
|
74
|
+
:width => av_width / 8, :justification => :center,
|
75
|
+
:border => true, :font_size => 12
|
76
|
+
end
|
77
|
+
|
78
|
+
span do
|
79
|
+
|
80
|
+
caption "Income",
|
81
|
+
:width => av_width / 8, :justification => :center,
|
82
|
+
:border => true, :font_size => 12
|
83
|
+
|
84
|
+
caption "2000",
|
85
|
+
:width => av_width / 8, :justification => :center,
|
86
|
+
:border => true, :font_size => 12
|
87
|
+
caption "2001",
|
88
|
+
:width => av_width / 8, :justification => :center,
|
89
|
+
:border => true, :font_size => 12
|
90
|
+
caption "2002",
|
91
|
+
:width => av_width / 8, :justification => :center,
|
92
|
+
:border => true, :font_size => 12
|
93
|
+
caption "2003",
|
94
|
+
:width => av_width / 8, :justification => :center,
|
95
|
+
:border => true, :font_size => 12
|
96
|
+
caption "2004",
|
97
|
+
:width => av_width / 8, :justification => :center,
|
98
|
+
:border => true, :font_size => 12
|
99
|
+
caption "2005",
|
100
|
+
:width => av_width / 8, :justification => :center,
|
101
|
+
:border => true, :font_size => 12
|
102
|
+
caption "2006",
|
103
|
+
:width => av_width / 8, :justification => :center,
|
104
|
+
:border => true, :font_size => 12
|
105
|
+
end
|
106
|
+
|
107
|
+
span do
|
108
|
+
|
109
|
+
caption "Costs",
|
110
|
+
:width => av_width / 8, :justification => :center,
|
111
|
+
:border => true, :font_size => 12
|
112
|
+
|
113
|
+
caption "1000",
|
114
|
+
:width => av_width / 8, :justification => :center,
|
115
|
+
:border => true, :font_size => 12
|
116
|
+
caption "1001",
|
117
|
+
:width => av_width / 8, :justification => :center,
|
118
|
+
:border => true, :font_size => 12
|
119
|
+
caption "1002",
|
120
|
+
:width => av_width / 8, :justification => :center,
|
121
|
+
:border => true, :font_size => 12
|
122
|
+
caption "1003",
|
123
|
+
:width => av_width / 8, :justification => :center,
|
124
|
+
:border => true, :font_size => 12
|
125
|
+
caption "1004",
|
126
|
+
:width => av_width / 8, :justification => :center,
|
127
|
+
:border => true, :font_size => 12
|
128
|
+
caption "1005",
|
129
|
+
:width => av_width / 8, :justification => :center,
|
130
|
+
:border => true, :font_size => 12
|
131
|
+
caption "1006",
|
132
|
+
:width => av_width / 8, :justification => :center,
|
133
|
+
:border => true, :font_size => 12
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
footer do
|
139
|
+
|
140
|
+
span do
|
141
|
+
|
142
|
+
caption "1",
|
143
|
+
:width => av_width / 8, :justification => :center,
|
144
|
+
:border => true, :font_size => 9
|
145
|
+
|
146
|
+
caption "2",
|
147
|
+
:width => av_width / 8, :justification => :center,
|
148
|
+
:border => true, :font_size => 9
|
149
|
+
|
150
|
+
caption "3",
|
151
|
+
:width => av_width / 8, :justification => :center,
|
152
|
+
:border => true, :font_size => 9
|
153
|
+
|
154
|
+
caption "4",
|
155
|
+
:width => av_width/ 8, :justification => :center,
|
156
|
+
:border => true, :font_size => 9
|
157
|
+
|
158
|
+
caption "5",
|
159
|
+
:width => av_width / 8, :justification => :center,
|
160
|
+
:border => true, :font_size => 9
|
161
|
+
|
162
|
+
caption "6",
|
163
|
+
:width => av_width / 8, :justification => :center,
|
164
|
+
:border => true, :font_size => 9
|
165
|
+
|
166
|
+
caption "7",
|
167
|
+
:width => av_width / 8, :justification => :center,
|
168
|
+
:border => true, :font_size => 9
|
169
|
+
|
170
|
+
caption "8",
|
171
|
+
:width => av_width / 8, :justification => :center,
|
172
|
+
:border => true, :font_size => 9
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|