-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for images in signature/image fields.
Whether a signature field expects a digital signature or a text signature, an image can now be added into that field from a file or a base64 encoded string. In fact, adding images works for any field, and the image will always overwrite whatever was in the field while automatically resizing to fill the bounds.
- Loading branch information
Showing
15 changed files
with
148 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ sudo: false | |
language: ruby | ||
cache: bundler | ||
rvm: | ||
- 3.0.2 | ||
- 3.0.3 | ||
jdk: | ||
- openjdk8 | ||
before_install: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
require_relative 'fillable-pdf/itext' | ||
require_relative 'kernel' | ||
|
||
class Field | ||
# PdfName has a constant "A" and a constant "a". Unfortunately, RJB does not differentiate | ||
# between these constants and tries to create the same constant ("A") for both, which causes | ||
# an annoying warning "already initialized constant Rjb::Com_itextpdf_kernel_pdf_PdfName::A". | ||
# As long as RJB has not fixed this issue, this warning will remain suppressed. | ||
suppress_warnings { PDF_NAME = Rjb.import('com.itextpdf.kernel.pdf.PdfName') } # rubocop:disable Lint/ConstantDefinitionInBlock | ||
|
||
BUTTON = PDF_NAME.Btn.toString | ||
CHOICE = PDF_NAME.Ch.toString | ||
SIGNATURE = PDF_NAME.Sig.toString | ||
TEXT = PDF_NAME.Tx.toString | ||
BUTTON = ITEXT::PdfName.Btn.toString | ||
CHOICE = ITEXT::PdfName.Ch.toString | ||
SIGNATURE = ITEXT::PdfName.Sig.toString | ||
TEXT = ITEXT::PdfName.Tx.toString | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,24 @@ | ||
require_relative 'kernel' | ||
require 'rjb' | ||
|
||
Rjb.load(Dir.glob(File.expand_path('../../ext/*.jar', __dir__)).join(':')) | ||
|
||
module ITEXT | ||
suppress_warnings do | ||
ByteArrayOutputStream = Rjb.import 'com.itextpdf.io.source.ByteArrayOutputStream' | ||
Canvas = Rjb.import 'com.itextpdf.layout.Canvas' | ||
Div = Rjb.import 'com.itextpdf.layout.element.Div' | ||
HorizontalAlignment = Rjb.import 'com.itextpdf.layout.property.HorizontalAlignment' | ||
Image = Rjb.import 'com.itextpdf.layout.element.Image' | ||
ImageDataFactory = Rjb.import 'com.itextpdf.io.image.ImageDataFactory' | ||
PdfAcroForm = Rjb.import 'com.itextpdf.forms.PdfAcroForm' | ||
PdfDictionary = Rjb.import 'com.itextpdf.kernel.pdf.PdfDictionary' | ||
PdfDocument = Rjb.import 'com.itextpdf.kernel.pdf.PdfDocument' | ||
PdfFormXObject = Rjb.import 'com.itextpdf.kernel.pdf.xobject.PdfFormXObject' | ||
PdfName = Rjb.import 'com.itextpdf.kernel.pdf.PdfName' | ||
PdfReader = Rjb.import 'com.itextpdf.kernel.pdf.PdfReader' | ||
PdfWriter = Rjb.import 'com.itextpdf.kernel.pdf.PdfWriter' | ||
Rectangle = Rjb.import 'com.itextpdf.kernel.geom.Rectangle' | ||
VerticalAlignment = Rjb.import 'com.itextpdf.layout.property.VerticalAlignment' | ||
end | ||
end |
File renamed without changes.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters