Skip to content

How to move/resize text or field? #1213

Answered by Trapfether
mmahalwy asked this question in Q&A
Discussion options

You must be logged in to vote

Hello, There is a lower level API available for setting the position of form elements.

Provided you have a reference to the PDFField you want to move / resize, the following code should work for you.

const fieldWidget = field.getWidgets()[0]; // typically fields only have one widget, but exceptions exist
const currentRectangle = fieldWidget.getRectangle(); // this is how you would get the current position / size
fieldWidget.setRectangle({x: 0, y: 0, width: 100, height: 100}); // and here is the function you are looking for specifically

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mmahalwy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants