How to copy "X" and "Y" coordinates?
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
How to copy "X" and "Y" coordinates?
Hi all.
Who know how can i copy to buffer X and Y coordinates? Like CTRL+C. (See the picture)
Thnx.
Who know how can i copy to buffer X and Y coordinates? Like CTRL+C. (See the picture)
Thnx.
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 2771
- Joined: Wed Jan 18, 2006 12:10 pm
Re: How to copy "X" and "Y" coordinates?
The coordinates that you can see at the bottom of your screen are the coordinates of the mouse-pointer.
If you like to see the coordinates of a selected object (Text, Image, Shape, Comment, ...) then you can better use the Transform Selection dialog-box, available in the Home-ribbon > Selection > Transfer Selection.
In the raster you can select the point for which you like to see the coordinates (left upper corner, middle of the top line, ...).
The X-coordinate is the distance towards the left border of the page.
The Y-coordinate is the distance towards the bottom of the page.
Does that help ?
If you like to see the coordinates of a selected object (Text, Image, Shape, Comment, ...) then you can better use the Transform Selection dialog-box, available in the Home-ribbon > Selection > Transfer Selection.
In the raster you can select the point for which you like to see the coordinates (left upper corner, middle of the top line, ...).
The X-coordinate is the distance towards the left border of the page.
The Y-coordinate is the distance towards the bottom of the page.
Does that help ?
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
Sorry, but no. I need to copy cursor position, X and Y coordinates on the page (not coordinate object, text or comment), in the buffer, for paste this coordinate in excel or word.Willy Van Nuffel wrote: ↑Tue Feb 14, 2023 9:05 am The coordinates that you can see at the bottom of your screen are the coordinates of the mouse-pointer.
If you like to see the coordinates of a selected object (Text, Image, Shape, Comment, ...) then you can better use the Transfer Selection dialog-box, available in the Home-ribbon > Selection > Transfer Selection.
In the raster you can select the point for which you like to see the coordinates (left upper corner, middle of the top line, ...).
The X-coordinate is the distance towards the left border of the page.
The Y-coordinate is the distance towards the bottom of the page.
Does that help ?
-
- User
- Posts: 2771
- Joined: Wed Jan 18, 2006 12:10 pm
Re: How to copy "X" and "Y" coordinates?
For as far as I know, it is not possible to copy the coordinates of the cursor position in PDF-XChange Editor.
@Tracker Support
Maybe this is an item for a feature request ?
@Tracker Support
Maybe this is an item for a feature request ?
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
I thought JavaScript can.Willy Van Nuffel wrote: ↑Tue Feb 14, 2023 11:45 am For as far as I know, it is not possible to copy the coordinates of the cursor position in PDF-XChange Editor.
@Tracker Support
Maybe this is an item for a feature request ?
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
I presume you not just need the coordinated but would need to do something else with them after?
You can indeed capture the coordinates of the mouse with JS:
Kind regards,
Stefan
I presume you not just need the coordinated but would need to do something else with them after?
You can indeed capture the coordinates of the mouse with JS:
Code: Select all
function getMouseCoor() {
console.println( "("+this.mouseX+","+ this.mouseY+")" );
}
var ckMouse = app.setInterval("getMouseCoor()", 100); var timeout = app.setTimeOut(
"app.clearInterval(ckMouse); app.clearTimeOut(timeout)",2000);
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
Thnx! But, what i do wrong?After left/r click nothing...Tracker Supp-Stefan wrote: ↑Tue Feb 14, 2023 2:25 pm Hello anton121,
I presume you not just need the coordinated but would need to do something else with them after?
You can indeed capture the coordinates of the mouse with JS:Code: Select all
function getMouseCoor() { console.println( "("+this.mouseX+","+ this.mouseY+")" ); } var ckMouse = app.setInterval("getMouseCoor()", 100); var timeout = app.setTimeOut( "app.clearInterval(ckMouse); app.clearTimeOut(timeout)",2000);
Kind regards,
Stefan
If have some way, to copy coordinates to buffer ( set some key CTRL+C+B for example) will be nice

You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
There's no such way to copy the mouse coordinates.
Why do you need those?
What is the next step for which you will need those stored?
I presume that if you need these for a different application you will have to write them down while the mouse cursor is at the desired coordinates. (E.g. you can open a notepad window with just the keyboard, so that the mouse location stays the same.)
Kind regards,
Stefan
There's no such way to copy the mouse coordinates.
Why do you need those?
What is the next step for which you will need those stored?
I presume that if you need these for a different application you will have to write them down while the mouse cursor is at the desired coordinates. (E.g. you can open a notepad window with just the keyboard, so that the mouse location stays the same.)
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
I need only get cursor coordinate X and Y, then i past them in word or excel. If They will be in console - good.Tracker Supp-Stefan wrote: ↑Tue Feb 14, 2023 3:14 pm Hello anton121,
There's no such way to copy the mouse coordinates.
Why do you need those?
What is the next step for which you will need those stored?
I presume that if you need these for a different application you will have to write them down while the mouse cursor is at the desired coordinates. (E.g. you can open a notepad window with just the keyboard, so that the mouse location stays the same.)
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
Actually I think I managed to get the JS console capture the desired result!
So - if you want a value in mm rounded to two decimal places - please open the JS console in the Editor (Ctrl + J ) and then paste this in there:
Then move your mouse to the coordinates you want to measure without clicking , and hit Ctrl + Enter. This will execute the code in the JS console, and you will then receive your coordinates in the output of the JS console like this:
I've deliberately captured part of the Editor window - where you can compare the coordinates reported by the Editor itself are the same (rounded to 1 decimal place) as the output in the console. If you want 1 decimal place precision - just change the 2 to 1 in .toFixed(1).
Kind regards,
Stefan
Actually I think I managed to get the JS console capture the desired result!
So - if you want a value in mm rounded to two decimal places - please open the JS console in the Editor (Ctrl + J ) and then paste this in there:
Code: Select all
console.println( "("+(this.mouseX/2.83464566929133).toFixed(2)+","+ (this.mouseY/2.83464566929133).toFixed(2)+")" );
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
Big thnx! I think is what i need. But i dont know why script not done - just nothing write in console. may be i need istall something to mi PC...Tracker Supp-Stefan wrote: ↑Tue Feb 14, 2023 4:54 pm Hello anton121,
Actually I think I managed to get the JS console capture the desired result!
So - if you want a value in mm rounded to two decimal places - please open the JS console in the Editor (Ctrl + J ) and then paste this in there:Then move your mouse to the coordinates you want to measure without clicking , and hit Ctrl + Enter. This will execute the code in the JS console, and you will then receive your coordinates in the output of the JS console like this:Code: Select all
console.println( "("+(this.mouseX/2.83464566929133).toFixed(2)+","+ (this.mouseY/2.83464566929133).toFixed(2)+")" );
image.png
I've deliberately captured part of the Editor window - where you can compare the coordinates reported by the Editor itself are the same (rounded to 1 decimal place) as the output in the console. If you want 1 decimal place precision - just change the 2 to 1 in .toFixed(1).
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
All good, install newest versionTracker Supp-Stefan wrote: ↑Tue Feb 14, 2023 4:54 pm Hello anton121,
Actually I think I managed to get the JS console capture the desired result!
So - if you want a value in mm rounded to two decimal places - please open the JS console in the Editor (Ctrl + J ) and then paste this in there:Then move your mouse to the coordinates you want to measure without clicking , and hit Ctrl + Enter. This will execute the code in the JS console, and you will then receive your coordinates in the output of the JS console like this:Code: Select all
console.println( "("+(this.mouseX/2.83464566929133).toFixed(2)+","+ (this.mouseY/2.83464566929133).toFixed(2)+")" );
image.png
I've deliberately captured part of the Editor window - where you can compare the coordinates reported by the Editor itself are the same (rounded to 1 decimal place) as the output in the console. If you want 1 decimal place precision - just change the 2 to 1 in .toFixed(1).
Kind regards,
Stefan

Now will try get PT coordinates
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
Actually - my above code will not work correctly for pages that have been rotated, or where the media box does not match the crop box.
This updated code should correct that:
Kind regards,
Stefan
Actually - my above code will not work correctly for pages that have been rotated, or where the media box does not match the crop box.
This updated code should correct that:
Code: Select all
m = (new Matrix2D).fromRotated(this, this.pageNum);
mInv = m.invert();
pt = mInv.transform([this.mouseX, this.mouseY]);
var pt2mm = 25.4 / 72.0;
console.println("X=" + pt[0] * pt2mm + ", Y=" + pt[1] * pt2mm);
Stefan
-
- User
- Posts: 1456
- Joined: Tue Nov 24, 2020 4:02 pm
Re: How to copy "X" and "Y" coordinates?
Crude solution?
Take a screenshot of the Page Measurement box.
I know it's dirty but it's also quick.
Take a screenshot of the Page Measurement box.
I know it's dirty but it's also quick.
All best,
FringePhil
FringePhil
-
- Site Admin
- Posts: 7388
- Joined: Wed Mar 25, 2009 10:37 pm
Re: How to copy "X" and "Y" coordinates?
Great suggestion Phil, though that would produce an image and it would need to be run through OCR to make it text to copy/paste.


Best regards
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
-
- User
- Posts: 1456
- Joined: Tue Nov 24, 2020 4:02 pm
Re: How to copy "X" and "Y" coordinates?
Or, heaven forbid, you read the digits and actually type them in...Paul - Tracker Supp wrote: ↑Thu Feb 16, 2023 3:23 pm ... it would need to be run through OCR to make it text to copy/paste.
....
All best,
FringePhil
FringePhil
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
Hello!Tracker Supp-Stefan wrote: ↑Wed Feb 15, 2023 9:12 am Hello anton121,
Actually - my above code will not work correctly for pages that have been rotated, or where the media box does not match the crop box.
This updated code should correct that:Kind regards,Code: Select all
m = (new Matrix2D).fromRotated(this, this.pageNum); mInv = m.invert(); pt = mInv.transform([this.mouseX, this.mouseY]); var pt2mm = 25.4 / 72.0; console.println("X=" + pt[0] * pt2mm + ", Y=" + pt[1] * pt2mm);
Stefan
I use this code to equal range:
scaled_value = low_2 + (high_2 - low_2) * (value - low) / (high - low)
and final code:
console.clear()
console.println( (4901.91+(739.97-4901.91)*(this.mouseY-0)/(4161.9-0)).toFixed(1)+";"+(2384+(345.17-2384)*(this.mouseX-0)/(2038.8-0)).toFixed(1));
All work

Now i try to find the way copy console result in buffer, if i can - ALT+ENTER, then CTRL+V and done

I find many functions:
1) util.setClipboardText(copiedText);
2) copyToClipboard(Text).
3) navigator.clipboard.writeText(Text);
But i cand use it, becouce program say " cant find this function"....
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
Those might be general JS methods, but they are in deed not supported inside PDF files (likely for security reasons).
In this file:
JavaScript for Acrobat API Reference
there is no mention of clipboard at all!
Kind regards,
Stefan
Those might be general JS methods, but they are in deed not supported inside PDF files (likely for security reasons).
In this file:
JavaScript for Acrobat API Reference
there is no mention of clipboard at all!
Kind regards,
Stefan
-
- User
- Posts: 13
- Joined: Tue Feb 14, 2023 4:54 am
Re: How to copy "X" and "Y" coordinates?
Its sad.... if i hame some values in console...why i cant copy them...)Tracker Supp-Stefan wrote: ↑Mon Feb 20, 2023 3:37 pm Hello anton121,
Those might be general JS methods, but they are in deed not supported inside PDF files (likely for security reasons).
In this file:
[url=https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/pdfs/acrobatsdk_jsapiref.pdf]JavaScript for Acrobat API Reference[/url]
there is no mention of clipboard at all!
Kind regards,
Stefan
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121,
The issue here is that you want to "write" those values to the clipboard, and that is the operation that is not available for JS code inside PDF files.
Kind regards,
Stefan
The issue here is that you want to "write" those values to the clipboard, and that is the operation that is not available for JS code inside PDF files.
Kind regards,
Stefan
-
- User
- Posts: 1826
- Joined: Sat Sep 11, 2021 5:04 am
Re: How to copy "X" and "Y" coordinates?
Hello anton121 and Stefan,
It might be useful to assign the function to copy the output on JavaScript Console to the clipboard to a specific key with autohotkey. In the verification video, after launching Free Clipboard Viewer and preparing to display the clipboard contents in real time, I moved the focus to JavaScript Console and pressed shortcut key F10 while moving the mouse.
Next, retrieve the variables with the autohotkey script as shown below.
Best regards,
rakunavi
It might be useful to assign the function to copy the output on JavaScript Console to the clipboard to a specific key with autohotkey. In the verification video, after launching Free Clipboard Viewer and preparing to display the clipboard contents in real time, I moved the focus to JavaScript Console and pressed shortcut key F10 while moving the mouse.
Code: Select all
F10::
WinActivate, JavaScript Console ahk_exe PDFXEdit.exe
Send, !{Enter}+{Up}^c
return
On a different note, many people are struggling with how to get variables and data out of JavaScript because of the security restrictions that Stefan has pointed out.Tracker Supp-Stefan wrote: ↑Tue Feb 21, 2023 12:27 pm The issue here is that you want to "write" those values to the clipboard, and that is the operation that is not available for JS code inside PDF files.
- https://stackoverflow.com/questions/13760440/write-text-file-using-acrobat-javascript
Code: Select all
this.info.Keywords = Variable_A;
this.info.Author = Variable_B;
this.info.Subject = Variable_C;
Code: Select all
DocumentInfo_Keywords := FileGetInfo("Document.pdf", 18, 1)
DocumentInfo_Author := FileGetInfo("Document.pdf", 20, 1)
DocumentInfo_Subject := FileGetInfo("Document.pdf", 22, 1)
- FileGetInfo() is introduced at the following URL.
https://www.autohotkey.com/boards/viewtopic.php?t=983
Best regards,
rakunavi
You do not have the required permissions to view the files attached to this post.
TOP desires for PDFXCE
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
forum.pdf-xchange.com/viewtopic.php?t=39665 LassoTool
forum.pdf-xchange.com/viewtopic.php?t=38554 CmtGarbled
forum.pdf-xchange.com/viewtopic.php?t=37353 FulScrMultiMon
forum.pdf-xchange.com/viewtopic.php?t=41002 DisableTouchSelect
-
- Site Admin
- Posts: 19913
- Joined: Mon Jan 12, 2009 8:07 am
Re: How to copy "X" and "Y" coordinates?
Hello rakunavi,
Many thanks for the above! I am not using AutoHotkey personally, but I presume it is of great help for anyone who needs it!
Kind regards,
Stefan
Many thanks for the above! I am not using AutoHotkey personally, but I presume it is of great help for anyone who needs it!
Kind regards,
Stefan