jpeg2pdf 0.12

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.
@@ -0,0 +1,38 @@
1
+ require 'rpdf/pdfobject'
2
+
3
+ module RPDF
4
+
5
+ # String Object
6
+ # [PDFRef15 p29]
7
+ class PDFString < PDFObject
8
+ attr_reader :value
9
+
10
+ attr_accessor :hexadecimal
11
+
12
+ def initialize(value, document=nil)
13
+ raise Exception.new("PDFString is not a string") unless value.kind_of?(String)
14
+ @value = value
15
+ @hexadecimal = false
16
+ super(document)
17
+ end
18
+
19
+ def ==(other)
20
+ @value == other.value
21
+ end
22
+
23
+ def to_s
24
+ if @hexadecimal
25
+ # [PDFRef15 p32]
26
+ hexval = String.new
27
+ @value.each_byte { |byte|
28
+ hexval << "%02X" % byte
29
+ }
30
+ "<#{hexval}>"
31
+ else
32
+ "(#{@value.dump})" # nonprinting characters should be replaced by \nnn and special characters escaped
33
+ end
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,15 @@
1
+ require 'rpdf/pdfarray'
2
+
3
+ module RPDF
4
+
5
+ # Rectangle Object
6
+ # [PDFRef15 p133]
7
+ class Rectangle < PDFArray
8
+
9
+ def initialize(llx, lly, urx, ury, document=nil)
10
+ super([llx, lly, urx, ury], document)
11
+ end
12
+
13
+ end
14
+
15
+ end
@@ -0,0 +1,30 @@
1
+ require 'rpdf/document'
2
+ require 'rpdf/pdfdictionary'
3
+ require 'rpdf/pdfinteger'
4
+ require 'rpdf/pdfname'
5
+
6
+ module RPDF
7
+
8
+ # File Trailer [PDFRef15 p72]
9
+ class Trailer
10
+
11
+ attr_accessor :startxref
12
+
13
+ def initialize(document)
14
+ @document = document
15
+ end
16
+
17
+ def to_pdf
18
+ dict = PDFDictionary.new({ :Size => @document.size + 1,
19
+ :Root => @document.root })
20
+
21
+ bytes = "trailer\n"
22
+ bytes << dict.to_pdf
23
+ bytes << "\nstartxref\n"
24
+ bytes << startxref.to_s << "\n"
25
+ bytes << "%%EOF\n"
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -0,0 +1,41 @@
1
+ module RPDF
2
+
3
+ EOL = "\r\n"
4
+
5
+ # [PDFRef15 p26]
6
+ def includes_whitespace?(string)
7
+ string =~ /[\0\t\r\n\f ]/ ? true : false
8
+ end
9
+
10
+ def includes_delimiter?(string)
11
+ string =~ /[\(\)<>\[\]{}\/%]/ ? true : false
12
+ end
13
+
14
+ # convert basic object to PDF Object
15
+ def topdfobject(object, document=nil)
16
+ if object.kind_of?(TrueClass) or object.kind_of?(FalseClass)
17
+ PDFBoolean.new(object, document)
18
+ elsif object.kind_of?(Integer)
19
+ PDFInteger.new(object, document)
20
+ elsif object.kind_of?(Numeric)
21
+ PDFNumeric.new(object, document)
22
+ elsif object.kind_of?(String)
23
+ PDFString.new(object, document)
24
+ elsif object.kind_of?(Symbol)
25
+ PDFName.new(object.to_s, document)
26
+ elsif object.kind_of?(Array)
27
+ PDFArray.new(object, document)
28
+ elsif object.kind_of?(Hash)
29
+ PDFDictionary.new(object, document)
30
+ elsif object.kind_of?(NilClass)
31
+ PDFNull.new
32
+ elsif object.kind_of?(PDFObject)
33
+ object
34
+ else
35
+ raise Exception.new("Cannot convert #{object.class} to PDF object")
36
+ end
37
+ end
38
+
39
+ module_function :includes_whitespace?, :includes_delimiter?, :topdfobject
40
+
41
+ end
@@ -0,0 +1,31 @@
1
+ module RPDF
2
+
3
+ # class describing a PDF version.
4
+ # Don't use this class directly, but use the constants defined in this file.
5
+ # [PDFRef15 p68]
6
+ class PDFVersion
7
+ include Comparable
8
+
9
+ attr_reader :value
10
+
11
+ def initialize(version_string)
12
+ @value = version_string
13
+ end
14
+
15
+ def <=>(other_version)
16
+ @value <=> other_version.value
17
+ end
18
+
19
+ def to_pdf
20
+ "%PDF-#{@value}\n"
21
+ end
22
+ end
23
+
24
+ VERSION_10 = PDFVersion.new("1.0")
25
+ VERSION_11 = PDFVersion.new("1.1")
26
+ VERSION_12 = PDFVersion.new("1.2")
27
+ VERSION_13 = PDFVersion.new("1.3")
28
+ VERSION_14 = PDFVersion.new("1.4")
29
+ VERSION_15 = PDFVersion.new("1.5")
30
+ VERSION_DEFAULT = VERSION_14
31
+ end
metadata ADDED
@@ -0,0 +1,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: "0.8"
3
+ specification_version: 1
4
+ name: jpeg2pdf
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.12"
7
+ date: 2004-10-23
8
+ summary: jpeg2pdf is a free program that converts a directory of JPEG files to a PDF file.
9
+ require_paths:
10
+ - lib
11
+ author: Koen Vervloesem
12
+ email: koen.vervloesem@myrealbox.com
13
+ homepage: http://koan.studentenweb.org/software/jpeg2pdf.html
14
+ rubyforge_project:
15
+ description:
16
+ autorequire: jpeg2pdf
17
+ default_executable: jpeg2pdf
18
+ bindir: bin
19
+ has_rdoc: true
20
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
21
+ requirements:
22
+ -
23
+ - ">"
24
+ - !ruby/object:Gem::Version
25
+ version: 0.0.0
26
+ version:
27
+ platform: ruby
28
+ files:
29
+ - bin
30
+ - install.rb
31
+ - lib
32
+ - LICENSE
33
+ - README
34
+ - jpeg2pdf.gemspec
35
+ - bin/jpeg2pdf
36
+ - bin/test.rb
37
+ - lib/image_size.rb
38
+ - lib/jpeg2pdf.rb
39
+ - lib/rpdf
40
+ - lib/rpdf.rb
41
+ - lib/rpdf/crossreftable.rb
42
+ - lib/rpdf/document.rb
43
+ - lib/rpdf/documentcatalog.rb
44
+ - lib/rpdf/imagedictionary.rb
45
+ - lib/rpdf/page.rb
46
+ - lib/rpdf/pagetree.rb
47
+ - lib/rpdf/pdfarray.rb
48
+ - lib/rpdf/pdfboolean.rb
49
+ - lib/rpdf/pdfdictionary.rb
50
+ - lib/rpdf/pdfinteger.rb
51
+ - lib/rpdf/pdfname.rb
52
+ - lib/rpdf/pdfnull.rb
53
+ - lib/rpdf/pdfnumeric.rb
54
+ - lib/rpdf/pdfobject.rb
55
+ - lib/rpdf/pdfstream.rb
56
+ - lib/rpdf/pdfstring.rb
57
+ - lib/rpdf/rectangle.rb
58
+ - lib/rpdf/trailer.rb
59
+ - lib/rpdf/util.rb
60
+ - lib/rpdf/version.rb
61
+ test_files: []
62
+ rdoc_options:
63
+ - "--main"
64
+ - README
65
+ extra_rdoc_files:
66
+ - README
67
+ executables:
68
+ - jpeg2pdf
69
+ extensions: []
70
+ requirements: []
71
+ dependencies: []