Skip to main content
Participant
Nov 2, 2020 4:47 PM UTC
Question

Change text position using javascript

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 is closed to new replies. Start a new post to keep the conversation going.

4 replies

20195E7CAuthor
Participant
Nov 3, 2020 8:13 AM UTC

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 🙂

Translate
Thom Parker
Community Expert
Community Expert
Nov 3, 2020 3:26 PM UTC

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. 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Thom Parker
Community Expert
Community Expert
Nov 2, 2020 7:42 PM UTC

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

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Bernd Alheit
Community Expert
Community Expert
Nov 2, 2020 5:23 PM UTC

Position of form fields or comments?

Translate