Skip to main content
Participant
November 2, 2020
Question

Change text position using javascript

  • November 2, 2020
  • 3 replies
  • 2467 views

Hello,

 

I would like to change x and y text position using javascript.

Clicking on a button, I would like to set x/y pos of differents text elements presents on my PDF.

Do you have a way to do it, I can't find any solution.

Thanks!!

This topic has been closed for replies.

3 replies

20195E7CAuthor
Participant
November 3, 2020

Thank you for your answers. I was not specific enough indeed.

I has a form text element in my PDF.

I would like to change it's position using javascript. Example :
myTextFormField.setxpos = 100;

myTextFormField.setypos = 100;

=> I know this os not the good code 🙂 Just for the example.

 

@Thom Parker  :

I'm going to read it thanks but not sur this is my need 🙂

Thom Parker
Community Expert
Community Expert
November 3, 2020

If it is a text field that is being moved, then the article is exactly what you need. You'll also find a free example that shows how to move fields here:

https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm

 

Look at the "Bouncing Button" and "Swat the Fly" example files. 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Thom Parker
Community Expert
Community Expert
November 2, 2020

The only way to do this is if the text is in a form field or annotation.

You can find scripting info on doing this here:

https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Bernd Alheit
Community Expert
Community Expert
November 2, 2020

Position of form fields or comments?