jpdfer 0.1.0 → 0.2.0
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/lib/jpdfer/pdf.rb +12 -0
- data/lib/jpdfer/version.rb +1 -1
- metadata +2 -2
data/lib/jpdfer/pdf.rb
CHANGED
@@ -6,6 +6,8 @@ module Jpdfer
|
|
6
6
|
class Pdf
|
7
7
|
class NonexistentFieldError < Exception; end
|
8
8
|
class ReadOnlyError < Exception; end
|
9
|
+
include_class Java::com.itextpdf.text.Image
|
10
|
+
include_class Java::java.net.URL
|
9
11
|
include_package "com.itextpdf.text.pdf"
|
10
12
|
include_package "com.itextpdf.text.xml.xmp"
|
11
13
|
|
@@ -212,6 +214,16 @@ module Jpdfer
|
|
212
214
|
@stamper.getSignatureAppearance.setLocation(location)
|
213
215
|
end
|
214
216
|
|
217
|
+
# Adds the image at +image_path+ to the given +page+, at coordinates +x+ and +y+
|
218
|
+
def add_image(image_path, page, x, y, scale=1.0)
|
219
|
+
raise ReadOnlyError.new('Previously saved pdfs are read-only') if @saved
|
220
|
+
canvas = @stamper.getOverContent(page)
|
221
|
+
image = Image.getInstance(image_path)
|
222
|
+
image.setAbsolutePosition(x, y)
|
223
|
+
image.scalePercent(scale * 100)
|
224
|
+
canvas.addImage(image, false)
|
225
|
+
end
|
226
|
+
|
215
227
|
end
|
216
228
|
|
217
229
|
end
|
data/lib/jpdfer/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jpdfer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Scott Nielsen
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2012-01-
|
14
|
+
date: 2012-01-31 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|