pdf_gen 0.7
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,99 @@
|
|
1
|
+
$:.unshift(File.expand_path(File.dirname(__FILE__) + "/../"))
|
2
|
+
require "lib/pdf_gen"
|
3
|
+
|
4
|
+
|
5
|
+
PDFGen::document PDF::Writer.new, 0.cm do
|
6
|
+
caption " SWOT analysis is a strategic planning method used to evaluate the Strengths, Weaknesses,
|
7
|
+
Opportunities, and Threats involved in a project or in a business venture. It involves specifying
|
8
|
+
the objective of the business venture or project and identifying the internal and external factors that
|
9
|
+
are favorable and unfavorable to achieve that objective. The technique is credited to Albert Humphrey,
|
10
|
+
who led a convention at Stanford University in the 1960s and 1970s using data from Fortune 500 companies. ",
|
11
|
+
:justification => :left, :font_size => 12
|
12
|
+
|
13
|
+
caption " A SWOT analysis must first start with defining a desired end state or objective.
|
14
|
+
A SWOT analysis may be incorporated into the strategic planning model. Strategic Planning, has been
|
15
|
+
the subject of much research. Identification of SWOTs are essential because subsequent steps in the process
|
16
|
+
of planning for achievement of the selected objective may be derived from the SWOTs. First, the decision
|
17
|
+
makers have to determine whether the objective is attainable, given the SWOTs. If the objective is NOT
|
18
|
+
attainable a different objective must be selected and the process repeated. The SWOT analysis is often
|
19
|
+
used in academia to highlight and identify strengths, weaknesses, opportunities and threats.[citation needed]
|
20
|
+
It is particularly helpful in identifying areas for development. The aim of any SWOT analysis is to identify
|
21
|
+
the key internal and external factors that are important to achieving the objective. These come from within the
|
22
|
+
company's unique value chain. ",
|
23
|
+
:justification => :left, :font_size => 12
|
24
|
+
|
25
|
+
div :width => 15.cm, :pad_left => 3.cm do
|
26
|
+
|
27
|
+
table do
|
28
|
+
title do
|
29
|
+
caption " Table 1. <b>SWOT analysis</b>",
|
30
|
+
:justification => :left, :font_size => 10
|
31
|
+
end
|
32
|
+
|
33
|
+
body do
|
34
|
+
span do
|
35
|
+
caption "Strengths",
|
36
|
+
:width => av_width / 2, :justification => :center, :font_size => 12,
|
37
|
+
:border => true, :border_width => 2
|
38
|
+
|
39
|
+
|
40
|
+
caption "Threats",
|
41
|
+
:width => av_width / 2, :justification => :center, :font_size => 12,
|
42
|
+
:border => true, :border_width => 2
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
span do
|
47
|
+
caption " characteristics of the business or team that give it an advantage over others in the industry ",
|
48
|
+
:width => av_width / 2, :justification => :left, :font_size => 12, :border => true
|
49
|
+
|
50
|
+
|
51
|
+
caption " external elements in the environment that could cause trouble for the business. ",
|
52
|
+
:width => av_width / 2, :justification => :left, :font_size => 12, :border => true
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
span do
|
57
|
+
caption "Opportunities",
|
58
|
+
:width => av_width / 2, :justification => :center, :font_size => 12,
|
59
|
+
:border => true, :border_width => 2
|
60
|
+
|
61
|
+
caption "Weaknesses",
|
62
|
+
:width => av_width / 2, :justification => :center, :font_size => 12,
|
63
|
+
:border => true, :border_width => 2
|
64
|
+
end
|
65
|
+
|
66
|
+
span do
|
67
|
+
caption " external chances to make greater sales or profits in the environment. ",
|
68
|
+
:width => av_width / 2, :justification => :left, :font_size => 12,
|
69
|
+
:border => true
|
70
|
+
|
71
|
+
caption " characteristics that place the firm at a disadvantage relative to others. ",
|
72
|
+
:width => av_width / 2, :justification => :left, :font_size => 12,
|
73
|
+
:border => true
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
caption " SWOT analysis groups key pieces of information into two main categories:
|
81
|
+
1.Internal factors - The strengths and weaknesses internal to the organization.
|
82
|
+
2.External factors - The opportunities and threats presented by the external environment to the organization.
|
83
|
+
Use a PEST or PESTLE analysis to help identify factors The internal factors may be viewed as strengths or
|
84
|
+
weaknesses depending upon their impact on the organization's objectives.
|
85
|
+
What may represent strengths with respect to one objective may be weaknesses for another objective.
|
86
|
+
The factors may include all of the 4P's; as well as personnel, finance, manufacturing capabilities, and so on.
|
87
|
+
The external factors may include macroeconomic matters, technological change, legislation,
|
88
|
+
and socio-cultural changes, as well as changes in the marketplace or competitive position.
|
89
|
+
The results are often presented in the form of a matrix. SWOT analysis is just one method of
|
90
|
+
categorization and has its own weaknesses. For example, it may tend to persuade companies to compile
|
91
|
+
lists rather than think about what is actually important in achieving objectives.
|
92
|
+
It also presents the resulting lists uncritically and without clear prioritization so that, for example,
|
93
|
+
weak opportunities may appear to balance strong threats. It is prudent not to eliminate too
|
94
|
+
quickly any candidate SWOT entry. The importance of individual SWOTs will be revealed by
|
95
|
+
the value of the strategies it generates. A SWOT item that produces valuable strategies is important.
|
96
|
+
A SWOT item that generates no strategies is not important. ",
|
97
|
+
:justification => :left, :font_size => 12
|
98
|
+
|
99
|
+
end.save("#{File.basename(__FILE__, ".rb")}.pdf")
|
@@ -0,0 +1,99 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/caption.rb'
|
4
|
+
require 'lib/writer.rb'
|
5
|
+
require 'pdf/writer'
|
6
|
+
require "lib/fixnum"
|
7
|
+
require 'lib/pdf_gen'
|
8
|
+
require 'test/shared_examples'
|
9
|
+
require "test/helpers_for_testing"
|
10
|
+
include PDFGen
|
11
|
+
include PDF
|
12
|
+
include HelpersForTesting
|
13
|
+
|
14
|
+
|
15
|
+
describe "A new caption" do
|
16
|
+
before(:all) do
|
17
|
+
@caption = create_caption
|
18
|
+
@caption.paddings = 0
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:base_region){@caption}
|
22
|
+
it_should_behave_like "base region"
|
23
|
+
|
24
|
+
it "should not have text " do
|
25
|
+
@caption.text.should == ""
|
26
|
+
end
|
27
|
+
it "should have left justification" do
|
28
|
+
@caption.justification.should == :left
|
29
|
+
end
|
30
|
+
it "should have false bold" do
|
31
|
+
@caption.bold.should == false
|
32
|
+
end
|
33
|
+
it "should have font_size as pdf font size" do
|
34
|
+
doc = Document.new Writer.new, 0.cm
|
35
|
+
@caption.font_size.should == doc.pdf.font_size
|
36
|
+
end
|
37
|
+
end
|
38
|
+
describe "Caption's setters" do
|
39
|
+
before(:each) do
|
40
|
+
@caption = create_caption
|
41
|
+
@caption.paddings = 0
|
42
|
+
end
|
43
|
+
it "for text" do
|
44
|
+
|
45
|
+
@caption.text="some text"
|
46
|
+
@caption.text.should == "some text"
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
it "for text color" do
|
51
|
+
@caption.text_color = Color::RGB::Blue
|
52
|
+
@caption.text_color.should == Color::RGB::Blue
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
it "for justification" do
|
57
|
+
@caption.justification = :left
|
58
|
+
@caption.justification.should == :left
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
it "for bold" do
|
63
|
+
@caption.bold = true
|
64
|
+
@caption.bold.should == true
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
it "for font size" do
|
69
|
+
@caption.font_size = 12
|
70
|
+
@caption.font_size.should == 12
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe "caption minimal height" do
|
75
|
+
before(:each) do
|
76
|
+
@caption = create_caption
|
77
|
+
@caption.paddings = 0
|
78
|
+
@doc = Document.new Writer.new, 0.cm
|
79
|
+
end
|
80
|
+
context "when padding is zero" do
|
81
|
+
it "should be equal to the font height" do
|
82
|
+
@caption.calculate_minimal_height.should == @doc.pdf.font_height
|
83
|
+
end
|
84
|
+
end
|
85
|
+
context "when padding top is not zero" do
|
86
|
+
it "should be equal to the font height plus top padding" do
|
87
|
+
@caption.pad_top = 10
|
88
|
+
@caption.calculate_minimal_height.should == @doc.pdf.font_height + @caption.pad_top
|
89
|
+
end
|
90
|
+
end
|
91
|
+
context "when padding top and padding bottom is not zero" do
|
92
|
+
it "should be equal to the font height plus top padding plus bottom margin" do
|
93
|
+
@caption.pad_top = 10
|
94
|
+
@caption.pad_bottom = 10
|
95
|
+
@caption.calculate_minimal_height.should == @doc.pdf.font_height + @caption.pad_top + @caption.pad_bottom
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/caption.rb'
|
4
|
+
require 'lib/writer.rb'
|
5
|
+
require 'pdf/writer'
|
6
|
+
require "lib/fixnum"
|
7
|
+
require 'lib/pdf_gen'
|
8
|
+
require 'test/shared_examples.rb'
|
9
|
+
require "test/helpers_for_testing"
|
10
|
+
include PDFGen
|
11
|
+
include PDF
|
12
|
+
include SpanContainer
|
13
|
+
include HelpersForTesting
|
14
|
+
|
15
|
+
|
16
|
+
describe "common styles for container" do
|
17
|
+
it "set common style for all regions" do
|
18
|
+
container = create_span
|
19
|
+
region1 = create_caption
|
20
|
+
region2 = create_caption
|
21
|
+
|
22
|
+
container.add_region(region1)
|
23
|
+
container.add_region(region2)
|
24
|
+
|
25
|
+
container.elements :width => 100
|
26
|
+
region1.width.should == 100 and
|
27
|
+
region2.width.should == 100
|
28
|
+
end
|
29
|
+
end
|
data/test/div_test.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/writer.rb'
|
4
|
+
require 'pdf/writer'
|
5
|
+
require "lib/fixnum"
|
6
|
+
require 'lib/pdf_gen'
|
7
|
+
require 'lib/containers/div_container'
|
8
|
+
require "test/helpers_for_testing"
|
9
|
+
include HelpersForTesting
|
10
|
+
include PDFGen
|
11
|
+
include Composite
|
12
|
+
|
13
|
+
describe "Div" do
|
14
|
+
before(:each) do
|
15
|
+
@div = create_div
|
16
|
+
@document = Document.new(Writer.new, 0.cm)
|
17
|
+
|
18
|
+
caption = create_caption
|
19
|
+
caption.height = 500
|
20
|
+
caption1 = create_caption
|
21
|
+
caption1.height = 500
|
22
|
+
|
23
|
+
@div.add_region(caption)
|
24
|
+
@div.add_region(caption1)
|
25
|
+
end
|
26
|
+
it "should right calculate pages count" do
|
27
|
+
@document.add_region(@div)
|
28
|
+
@document.render
|
29
|
+
@document.pdf.pageset.size.should == 2
|
30
|
+
end
|
31
|
+
it "should right calculate height with test step" do
|
32
|
+
@div.render([0,@document.pdf.y],@document.pdf.y,true).should == [500,false]
|
33
|
+
end
|
34
|
+
it "should right calculate height with horizontal_interval" do
|
35
|
+
@div.horizontal_interval = 20
|
36
|
+
@div.render([0,@document.pdf.y],@document.pdf.y,true).should == [520,false]
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
include PDF
|
2
|
+
module HelpersForTesting
|
3
|
+
def create_span
|
4
|
+
doc = Document.new Writer.new, 0.cm
|
5
|
+
Span.new doc
|
6
|
+
end
|
7
|
+
|
8
|
+
def create_caption
|
9
|
+
Caption.new(Document.new Writer.new, 0.cm)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_div
|
13
|
+
Div.new(Document.new Writer.new, 0)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_table
|
17
|
+
Table.new(Document.new Writer.new, 0)
|
18
|
+
end
|
19
|
+
end
|
data/test/image_test.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/caption'
|
4
|
+
require 'lib/writer'
|
5
|
+
require 'pdf/writer'
|
6
|
+
require "lib/fixnum"
|
7
|
+
require 'lib/pdf_gen'
|
8
|
+
require 'test/shared_examples'
|
9
|
+
require "test/helpers_for_testing"
|
10
|
+
include PDFGen
|
11
|
+
include PDF
|
12
|
+
include SpanContainer
|
13
|
+
include HelpersForTesting
|
14
|
+
|
15
|
+
class PDF::Writer::Graphics::ImageInfo
|
16
|
+
def initialize(data)
|
17
|
+
@width = data[0]
|
18
|
+
@height = data[1]
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :height
|
22
|
+
attr_accessor :width
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
describe "A new image" do
|
27
|
+
context "when we set only width" do
|
28
|
+
it "should right calculate height" do
|
29
|
+
image = Image.new(Document.new(Writer.new, 0.cm), [250, 400])
|
30
|
+
image.set_properties :width => 100
|
31
|
+
height = 100 * 400 / 250.to_f
|
32
|
+
image.width.should == 100 and
|
33
|
+
image.height.should == height
|
34
|
+
end
|
35
|
+
end
|
36
|
+
context "when we set only height" do
|
37
|
+
it "should right calculate width" do
|
38
|
+
image = Image.new(Document.new(Writer.new, 0.cm), [250, 400])
|
39
|
+
image.set_properties :height => 100
|
40
|
+
width = 100 * 250 / 400.to_f
|
41
|
+
image.height.should == 100 and
|
42
|
+
image.width.should == width
|
43
|
+
end
|
44
|
+
end
|
45
|
+
context "when we set height and width" do
|
46
|
+
it "params should remain the same" do
|
47
|
+
image = Image.new(Document.new(Writer.new, 0.cm), [250, 400])
|
48
|
+
image.set_properties :height => 100, :width => 200
|
49
|
+
image.height.should == 100 and
|
50
|
+
image.width.should == 200
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -0,0 +1,68 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/caption'
|
4
|
+
require 'lib/writer'
|
5
|
+
require 'pdf/writer'
|
6
|
+
require "lib/fixnum"
|
7
|
+
require 'lib/pdf_gen'
|
8
|
+
require 'lib/base_region'
|
9
|
+
|
10
|
+
shared_examples_for "base region" do
|
11
|
+
it "should have width equal to zero" do
|
12
|
+
base_region.width.should == 0
|
13
|
+
end
|
14
|
+
it "should have setter for the page top padding" do
|
15
|
+
base_region.page_pad_top = 5
|
16
|
+
base_region.page_pad_top.should == 5
|
17
|
+
end
|
18
|
+
it "should return write height" do
|
19
|
+
base_region.height = 12
|
20
|
+
base_region.height.should == 12
|
21
|
+
end
|
22
|
+
it "should have false borders " do
|
23
|
+
base_region.border_left.should == false and
|
24
|
+
base_region.border_right.should == false and
|
25
|
+
base_region.border_top.should == false and
|
26
|
+
base_region.border_bottom.should == false
|
27
|
+
end
|
28
|
+
it "should have solid black border style" do
|
29
|
+
base_region.border_style.should == :solid and
|
30
|
+
base_region.border_color.should == Color::RGB::Black
|
31
|
+
end
|
32
|
+
it "should have all paddings equal to zero" do
|
33
|
+
base_region.pad_top.should == 0 and
|
34
|
+
base_region.pad_left.should == 0 and
|
35
|
+
base_region.pad_right.should == 0 and
|
36
|
+
base_region.pad_bottom.should == 0
|
37
|
+
end
|
38
|
+
it "should have background color equal to nil" do
|
39
|
+
base_region.background_color.should == nil
|
40
|
+
end
|
41
|
+
it "should have setter for the width" do
|
42
|
+
base_region.width = 10
|
43
|
+
base_region.width.should == 10
|
44
|
+
end
|
45
|
+
it "should have setter for the all borders" do
|
46
|
+
base_region.border = 5
|
47
|
+
base_region.border_left.should == 5 and
|
48
|
+
base_region.border_right.should == 5 and
|
49
|
+
base_region.border_top.should == 5 and
|
50
|
+
base_region.border_bottom.should == 5
|
51
|
+
end
|
52
|
+
it "should have setter for the top padding" do
|
53
|
+
base_region.pad_top = 5
|
54
|
+
base_region.pad_top == 5
|
55
|
+
end
|
56
|
+
it "should have setter for the left padding" do
|
57
|
+
base_region.pad_left = 5
|
58
|
+
base_region.pad_left == 5
|
59
|
+
end
|
60
|
+
it "should have setter for the right padding" do
|
61
|
+
base_region.pad_right = 5
|
62
|
+
base_region.pad_right == 5
|
63
|
+
end
|
64
|
+
it "should have setter for the top padding" do
|
65
|
+
base_region.pad_right = 5
|
66
|
+
base_region.pad_right == 5
|
67
|
+
end
|
68
|
+
end
|
data/test/span_test.rb
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/caption'
|
4
|
+
require 'lib/writer'
|
5
|
+
require 'pdf/writer'
|
6
|
+
require "lib/fixnum"
|
7
|
+
require 'lib/pdf_gen'
|
8
|
+
require 'test/shared_examples'
|
9
|
+
require "test/helpers_for_testing"
|
10
|
+
include PDFGen
|
11
|
+
include PDF
|
12
|
+
include SpanContainer
|
13
|
+
include HelpersForTesting
|
14
|
+
|
15
|
+
|
16
|
+
describe "New span" do
|
17
|
+
let(:base_region){create_span}
|
18
|
+
it_should_behave_like "base region"
|
19
|
+
|
20
|
+
it "right calculation min height,if height bigger than font_height" do
|
21
|
+
span_el = create_span
|
22
|
+
span_el.set_properties(:pad_top => 3, :pad_bottom => 4)
|
23
|
+
|
24
|
+
caption1 = create_caption
|
25
|
+
caption1.set_properties(:height => 12)
|
26
|
+
caption1.paddings = 0
|
27
|
+
|
28
|
+
caption2 = create_caption
|
29
|
+
caption2.set_properties(:height => 15)
|
30
|
+
caption2.paddings = 0
|
31
|
+
|
32
|
+
span_el.add_region(caption1)
|
33
|
+
span_el.add_region(caption2)
|
34
|
+
|
35
|
+
span_el.calculate_minimal_height.should == 22
|
36
|
+
end
|
37
|
+
it "right calculation min height,if height less than font_height" do
|
38
|
+
span_el = create_span
|
39
|
+
span_el.set_properties(:pad_top => 3, :pad_bottom => 4)
|
40
|
+
|
41
|
+
caption1 = create_caption
|
42
|
+
caption1.set_properties(:height => 2)
|
43
|
+
caption1.paddings = 0
|
44
|
+
|
45
|
+
caption2 = create_caption
|
46
|
+
caption2.set_properties(:height => 3)
|
47
|
+
caption2.paddings = 0
|
48
|
+
|
49
|
+
span_el.add_region(caption1)
|
50
|
+
span_el.add_region(caption2)
|
51
|
+
|
52
|
+
Integer(span_el.calculate_minimal_height).should == 18
|
53
|
+
end
|
54
|
+
it "right calculate content height with vertical interval" do
|
55
|
+
span_el = create_span
|
56
|
+
span_el.width = 150
|
57
|
+
caption1 = create_caption
|
58
|
+
caption1.set_properties(:width => 50)
|
59
|
+
|
60
|
+
caption2 = create_caption
|
61
|
+
caption2.set_properties(:width => 50)
|
62
|
+
|
63
|
+
span_el.add_region(caption1)
|
64
|
+
span_el.add_region(caption2)
|
65
|
+
|
66
|
+
span_el.vertical_interval = 5
|
67
|
+
span_el.render_regions.should == 105
|
68
|
+
end
|
69
|
+
it "right calculate content height with vertical align" do
|
70
|
+
span_el = create_span
|
71
|
+
span_el.set_properties(:height => 100, :width=>100)
|
72
|
+
span_el.vertical_align = true
|
73
|
+
|
74
|
+
caption1 = create_caption
|
75
|
+
caption1.set_properties(:width => 50)
|
76
|
+
|
77
|
+
span_el.add_region(caption1)
|
78
|
+
span_el.render_regions
|
79
|
+
caption1.height.should == 100
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
data/test/table_test.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$: << File.expand_path("../")
|
2
|
+
require 'rubygems'
|
3
|
+
require 'lib/writer'
|
4
|
+
require 'pdf/writer'
|
5
|
+
require "lib/fixnum"
|
6
|
+
require 'lib/pdf_gen'
|
7
|
+
require 'lib/containers/div_container'
|
8
|
+
require "test/helpers_for_testing"
|
9
|
+
|
10
|
+
include HelpersForTesting
|
11
|
+
include PDFGen
|
12
|
+
include Composite
|
13
|
+
class Table
|
14
|
+
attr_accessor :title, :header, :data, :footer
|
15
|
+
end
|
16
|
+
describe "Table" do
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@table = create_table
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should set inner region's width to the table's width" do
|
23
|
+
@table.width = 900
|
24
|
+
@table.title.width.should == 900
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pdf_gen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 5
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 7
|
9
|
+
version: "0.7"
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Sphere Consulting Inc.
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-11-19 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: pdf-writer
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 1
|
32
|
+
- 8
|
33
|
+
version: 1.1.8
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: " Sph_pdf_gen is a wrapper on PDF Writer generator for Ruby\n"
|
37
|
+
email:
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- lib/base_region.rb
|
46
|
+
- lib/caption.rb
|
47
|
+
- lib/containers/caption_container.rb
|
48
|
+
- lib/containers/div_container.rb
|
49
|
+
- lib/containers/image_container.rb
|
50
|
+
- lib/containers/span_container.rb
|
51
|
+
- lib/containers/table_container.rb
|
52
|
+
- lib/data/ds_ar.rb
|
53
|
+
- lib/data/ds_base.rb
|
54
|
+
- lib/data/ds_hash.rb
|
55
|
+
- lib/div.rb
|
56
|
+
- lib/document.rb
|
57
|
+
- lib/fixnum.rb
|
58
|
+
- lib/float.rb
|
59
|
+
- lib/image.rb
|
60
|
+
- lib/modules/base_attributes.rb
|
61
|
+
- lib/modules/canvas.rb
|
62
|
+
- lib/modules/composite.rb
|
63
|
+
- lib/pdf_gen.rb
|
64
|
+
- lib/smart_table.rb
|
65
|
+
- lib/span.rb
|
66
|
+
- lib/table.rb
|
67
|
+
- lib/writer.rb
|
68
|
+
- LICENSE
|
69
|
+
- README.rdoc
|
70
|
+
- samples/border.rb
|
71
|
+
- samples/div.rb
|
72
|
+
- samples/div_illustration.rb
|
73
|
+
- samples/headerfooter.rb
|
74
|
+
- samples/image.rb
|
75
|
+
- samples/ruby_logo.jpg
|
76
|
+
- samples/sampl1_1.png
|
77
|
+
- samples/sampl1_2.png
|
78
|
+
- samples/sampl1_3.png
|
79
|
+
- samples/simple.rb
|
80
|
+
- samples/smart_table.rb
|
81
|
+
- samples/span.rb
|
82
|
+
- samples/spanindiv_ill.rb
|
83
|
+
- samples/span_illustration.rb
|
84
|
+
- samples/table.rb
|
85
|
+
- samples/tableindiv_ill.rb
|
86
|
+
- samples/table_illustration.rb
|
87
|
+
- test/caption_test.rb
|
88
|
+
- test/container_test.rb
|
89
|
+
- test/div_test.rb
|
90
|
+
- test/helpers_for_testing.rb
|
91
|
+
- test/image_test.rb
|
92
|
+
- test/shared_examples.rb
|
93
|
+
- test/span_test.rb
|
94
|
+
- test/table_test.rb
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: https://github.com/SphereConsultingInc/pdf_gen/
|
97
|
+
licenses: []
|
98
|
+
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
|
102
|
+
require_paths:
|
103
|
+
- lib
|
104
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 57
|
110
|
+
segments:
|
111
|
+
- 1
|
112
|
+
- 8
|
113
|
+
- 7
|
114
|
+
version: 1.8.7
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 23
|
121
|
+
segments:
|
122
|
+
- 1
|
123
|
+
- 3
|
124
|
+
- 6
|
125
|
+
version: 1.3.6
|
126
|
+
requirements: []
|
127
|
+
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 1.3.7
|
130
|
+
signing_key:
|
131
|
+
specification_version: 3
|
132
|
+
summary: PDF generator for Ruby
|
133
|
+
test_files:
|
134
|
+
- test/caption_test.rb
|
135
|
+
- test/container_test.rb
|
136
|
+
- test/div_test.rb
|
137
|
+
- test/image_test.rb
|
138
|
+
- test/span_test.rb
|
139
|
+
- test/table_test.rb
|