Skip to content
Snippets Groups Projects
Commit 81d4db90 authored by lhameury's avatar lhameury
Browse files

Fix issue on signature if saved position "Rectangle" class is rounded to int....

Fix issue on signature if saved position "Rectangle" class is rounded to int. Switch to Rectangle2D.Float to save stamp position to float
parent 264b5a3a
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
......@@ -238,10 +238,10 @@ public class PdfStampPositionService {
// Getting metadata
java.awt.Rectangle customCoordinatesRectangle = null;
Rectangle2D.Float customCoordinatesRectangle = null;
Integer customPage = null;
try {
customCoordinatesRectangle = (java.awt.Rectangle) serviceRegistry.getNodeService().getProperty(documentRef, position);
customCoordinatesRectangle = (Rectangle2D.Float) serviceRegistry.getNodeService().getProperty(documentRef, position);
customPage = (Integer) serviceRegistry.getNodeService().getProperty(documentRef, page);
} catch (ClassCastException | InvalidNodeRefException ex) {
log.debug("Invalid PAdES custom signature location : ", ex);
......@@ -308,11 +308,11 @@ public class PdfStampPositionService {
* Saves already fetched x, y, ... from document #signature# tag to metadata.
*/
private void savePdfSignatureTagToMetadata(PdfSignatureStamp stamp, NodeRef documentRef) {
java.awt.Rectangle rectangle = new Rectangle();
rectangle.x = (int) stamp.getX();
rectangle.y = (int) stamp.getY();
rectangle.width = (int) stamp.getWidth();
rectangle.height = (int) stamp.getHeight();
Rectangle2D.Float rectangle = new Rectangle2D.Float();
rectangle.x = stamp.getX();
rectangle.y = stamp.getY();
rectangle.width = stamp.getWidth();
rectangle.height = stamp.getHeight();
serviceRegistry.getNodeService().setProperty(documentRef, ParapheurModel.PROP_SIGNATURE_TAG_POSITION_RECTANGLE, rectangle);
serviceRegistry.getNodeService().setProperty(documentRef, ParapheurModel.PROP_SIGNATURE_TAG_PAGE_NUMBER, stamp.getPage());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment