itext-jruby 0.0.8 → 0.0.9

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/README.rdoc CHANGED
@@ -29,6 +29,10 @@ Find more examples in test directory.
29
29
  * 0.0.6 - First stable version allowing adding attachments to PdfFile
30
30
  * 0.0.7 - Add option to sign documents usign pkcs12 certificates
31
31
  * 0.0.8 - Minor fixes
32
+ * 0.0.9 - Load jars only if required
33
+
34
+ == Known issues
35
+ * Problem with TorqueBox stack - https://issues.jboss.org/browse/TORQUE-1164
32
36
 
33
37
  == Read more
34
38
  * Creating pkcs12 certs: http://www.flatmtn.com/article/creating-pkcs12-certificates
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
data/itext-jruby.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "itext-jruby"
8
- s.version = "0.0.8"
8
+ s.version = "0.0.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ernest Bursa"]
12
- s.date = "2013-10-10"
12
+ s.date = "2013-10-20"
13
13
  s.description = "IText"
14
14
  s.email = "ernest@bzdury.pl"
15
15
  s.extra_rdoc_files = [
data/lib/itext-jruby.rb CHANGED
@@ -1,24 +1,42 @@
1
1
  # encoding: utf-8
2
2
  require 'java'
3
- Dir[File.expand_path(File.join(File.dirname(__FILE__), "../libexec/jar/*.jar"))].each { |jar| require jar }
4
3
 
5
- java_import java.io.ByteArrayOutputStream
6
- java_import com.lowagie.text.html.WebColors
7
- java_import com.lowagie.text.Document
8
- java_import com.lowagie.text.Paragraph
9
- java_import com.lowagie.text.Phrase
10
- java_import com.lowagie.text.PageSize
11
- java_import com.lowagie.text.Chunk
12
- java_import com.lowagie.text.pdf.PdfPCell
13
- java_import com.lowagie.text.pdf.PdfPTable
14
- java_import com.lowagie.text.BadElementException
15
- java_import com.lowagie.text.DocumentException
16
- java_import com.lowagie.text.Image
17
- java_import com.lowagie.text.pdf.PdfFileSpecification
18
- java_import com.lowagie.text.pdf.PdfReader
19
- java_import com.lowagie.text.pdf.PdfSignatureAppearance
20
- java_import com.lowagie.text.pdf.PdfStamper
21
- java_import com.lowagie.text.pdf.PdfWriter
22
- java_import java.io.FileOutputStream
4
+ class Itext
5
+
6
+ # Import all required jars and packages
7
+ def self.import_java(notify = false)
8
+ Dir[File.expand_path(File.join(File.dirname(__FILE__), "../libexec/jar/*.jar"))].each { |jar| require jar }
9
+
10
+ libs = [
11
+ java.io.ByteArrayOutputStream,
12
+ com.lowagie.text.html.WebColors,
13
+ com.lowagie.text.Document,
14
+ com.lowagie.text.Paragraph,
15
+ com.lowagie.text.Phrase,
16
+ com.lowagie.text.PageSize,
17
+ com.lowagie.text.Chunk,
18
+ com.lowagie.text.pdf.PdfPCell,
19
+ com.lowagie.text.pdf.PdfPTable,
20
+ com.lowagie.text.BadElementException,
21
+ com.lowagie.text.DocumentException,
22
+ com.lowagie.text.Image,
23
+ com.lowagie.text.pdf.PdfFileSpecification,
24
+ com.lowagie.text.pdf.PdfReader,
25
+ com.lowagie.text.pdf.PdfSignatureAppearance,
26
+ com.lowagie.text.pdf.PdfStamper,
27
+ com.lowagie.text.pdf.PdfWriter,
28
+ java.io.FileOutputStream
29
+ ]
30
+
31
+ # Require lib only if package not found
32
+ libs.each do |lib|
33
+ unless defined?(lib)
34
+ java_import(lib)
35
+ else
36
+ puts "Java Import: Allready defined: #{lib}" if notify
37
+ end
38
+ end
39
+ end
40
+ end
23
41
 
24
42
  require 'itext'
data/lib/itext.rb CHANGED
@@ -13,6 +13,7 @@ class Itext
13
13
  # Required params:
14
14
  # path: Pass absolute path to pdf file
15
15
  def initialize(*args, &block)
16
+ self.class.import_java # Import required deps
16
17
  super
17
18
 
18
19
  opts = args[0] if args.is_a?(Array)
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: itext-jruby
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.8
5
+ version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ernest Bursa
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-10 00:00:00.000000000 Z
12
+ date: 2013-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shoulda