Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions jsignpdf/src/main/java/net/sf/jsignpdf/SignerLogic.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,15 @@ public boolean signFile() {
final String tmpImgPath = options.getImgPath();
if (tmpImgPath != null) {
LOGGER.info(RES.get("console.createImage", tmpImgPath));
final Image img = Image.getInstance(tmpImgPath);
LOGGER.info(RES.get("console.setSignatureGraphic"));
sap.setSignatureGraphic(img);
if (tmpImgPath.endsWith(".pdf")) {
PdfReader sigreader = new PdfReader(tmpImgPath);
LOGGER.info(RES.get("console.setSignatureGraphic"));
sap.setSignaturePDF(sigreader, 1);
} else {
final Image img = Image.getInstance(tmpImgPath);
LOGGER.info(RES.get("console.setSignatureGraphic"));
sap.setSignatureGraphic(img);
}
}
final String tmpBgImgPath = options.getBgImgPath();
if (tmpBgImgPath != null) {
Expand Down Expand Up @@ -319,7 +325,7 @@ public boolean signFile() {
sap.setLayer4Text(options.getL4Text());
LOGGER.info(RES.get("console.setRender"));
RenderMode renderMode = options.getRenderMode();
if (renderMode == RenderMode.GRAPHIC_AND_DESCRIPTION && sap.getSignatureGraphic() == null) {
if (renderMode == RenderMode.GRAPHIC_AND_DESCRIPTION && !sap.hasValidSignatureGraphic()) {
LOGGER.warning(
"Render mode of visible signature is set to GRAPHIC_AND_DESCRIPTION, but no image is loaded. Fallback to DESCRIPTION_ONLY.");
LOGGER.info(RES.get("console.renderModeFallback"));
Expand Down