From 7bd11595e7e24f6a9869beb2c1053085eb613f4d Mon Sep 17 00:00:00 2001
From: Zdravko Iliev <zdravko.iliev@vereign.com>
Date: Fri, 15 Apr 2022 12:22:46 +0300
Subject: [PATCH] parse x,y pos to numbers

---
 dist/pdfParser.d.ts |  4 ++--
 dist/pdfParser.js   |  8 ++++----
 src/pdfParser.ts    | 10 +++++-----
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/dist/pdfParser.d.ts b/dist/pdfParser.d.ts
index 6c26499..d278d18 100644
--- a/dist/pdfParser.d.ts
+++ b/dist/pdfParser.d.ts
@@ -2,8 +2,8 @@
 import { IGetMetaResponse } from "./types";
 declare type SealCoords = {
     [key: string]: {
-        x: number;
-        y: number;
+        x: string;
+        y: string;
     };
 };
 declare class PDFparser {
diff --git a/dist/pdfParser.js b/dist/pdfParser.js
index 4fa7086..c700323 100644
--- a/dist/pdfParser.js
+++ b/dist/pdfParser.js
@@ -53,14 +53,14 @@ class PDFparser {
             for (let index = 0; index < pages.length; index++) {
                 const page = pages[index];
                 page.drawImage(img, {
-                    x: coords[index + 1].x,
-                    y: coords[index + 1].y,
+                    x: parseFloat(coords[index + 1].x),
+                    y: parseFloat(coords[index + 1].y),
                     width: scaled.width,
                     height: scaled.height,
                 });
                 const link = this.createPageLinkAnnotation(page, url, {
-                    imgXPos: coords[index + 1].x,
-                    imgYPos: coords[index + 1].y,
+                    imgXPos: parseFloat(coords[index + 1].x),
+                    imgYPos: parseFloat(coords[index + 1].y),
                     imgWidth: scaled.width,
                     imagHeight: scaled.height,
                 });
diff --git a/src/pdfParser.ts b/src/pdfParser.ts
index fe1fa8f..1f61058 100644
--- a/src/pdfParser.ts
+++ b/src/pdfParser.ts
@@ -8,7 +8,7 @@ import { AppError, GeneralError } from "./lib/errors";
 import { isPDF } from "./lib/generalUtils";
 
 type SealCoords = {
-  [key: string]: { x: number; y: number };
+  [key: string]: { x: string; y: string };
 };
 
 class PDFparser {
@@ -69,15 +69,15 @@ class PDFparser {
       const page = pages[index];
 
       page.drawImage(img, {
-        x: coords[index + 1].x,
-        y: coords[index + 1].y,
+        x: parseFloat(coords[index + 1].x),
+        y: parseFloat(coords[index + 1].y),
         width: scaled.width,
         height: scaled.height,
       });
 
       const link = this.createPageLinkAnnotation(page, url, {
-        imgXPos: coords[index + 1].x,
-        imgYPos: coords[index + 1].y,
+        imgXPos: parseFloat(coords[index + 1].x),
+        imgYPos: parseFloat(coords[index + 1].y),
         imgWidth: scaled.width,
         imagHeight: scaled.height,
       });
-- 
GitLab