1

I'm developing a web app using Angular, KonvaJS, and the ngx-extended-pdf-viewer library for digital document signing. In this web app, users who prepare documents add input fields made up of Konva groups containing rectangles and text. These fields need to be filled by signers. But I'm facing a problem with input field sizes that show up differently for signers.

I've ensured that the input field sizes are correctly set and saved in a MongoDB database through the backend. When the document is shown, the input fields are in the right positions for both document preparers and signers. However, when I adjust the sizes of these input fields, they look fine for the preparer but show up wrong for the signer. Interestingly, if I only move the input fields around without changing their sizes, they appear correctly for the signer.

Screenschots:

Document Preparer View

Document Signer View

NOTE: To differentiate the Preparer and Signer view, I just added a background color!

To give more context, I've used the ngx-extended-pdf-viewer library and created a special container/wrapper using a <div> to hold Konva layers. Inside this container, Konva groups with input fields are drawn. This container maintains the same size for both preparers and signers. Importantly, both preparers and signers use the exact same code to display these Konva groups.

I've tried different approaches, including using konva layer scaling value from the preparer's view, but I haven't been able to fix the problem of inconsistent input field sizes.

I'm seeking help from the community to understand this issue better and find a way to make sure that input field sizes are the same for both document preparers and signers. If you have any ideas, suggestions, or solutions, I'd greatly appreciate your input. Thank you for your time and assistance in helping me solve this issue.

Haffoo
  • 13
  • 3
  • Comparing the images it looks as if for the large text box the original group was transformed via a transformer scale operation. If that is correct then the key to know is that transformer affects only the x & y scale - not the width & height. So you may be storing the width in your mongodb but you need to compute the width as shape.scaleX() * shape.width(). There is a blog article on this here https://longviewcoder.com/2022/04/28/what-the-hell-did-the-transformer-actually-do-to-my-shape/ – Vanquished Wombat Aug 21 '23 at 18:44

0 Answers0