Issue with Coordinate in PDF-XChange
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: 5
- Joined: Thu Feb 27, 2025 9:09 am
Issue with Coordinate in PDF-XChange
Hello, PDF-XChange Support Team,
I am working on a project that involves placing interactive buttons on a PDF using JavaScript in PDF-XChange Editor. However, I have encountered a coordinate transformation issue where the positions of the buttons do not match the expected locations on the document.
Issue Details:
I am using the mouse cursor to retrieve the coordinates from my plan in PDF-XChange Editor.
When I place a button at (X: 250, Y: 480) using addField(), the actual position in the PDF is (X: 36, Y: 643).
Similarly, when placing a button at (X: 2750, Y: 899), it appears at (X: 978.25, Y: 588.59).
The coordinate transformation does not appear to follow a simple linear scale, nor is it reversible (placing a button at a "real" position does not return the expected original value).
Questions:
How does PDF-XChange handle coordinate transformations for interactive fields?
What is the correct formula or method to convert a given (X, Y) position in JavaScript into the actual coordinates used in PDF-XChange?
Is there a way to retrieve the transformed coordinates directly from the software to ensure correct placement?
Thank you for your support!
Best regards,
I am working on a project that involves placing interactive buttons on a PDF using JavaScript in PDF-XChange Editor. However, I have encountered a coordinate transformation issue where the positions of the buttons do not match the expected locations on the document.
Issue Details:
I am using the mouse cursor to retrieve the coordinates from my plan in PDF-XChange Editor.
When I place a button at (X: 250, Y: 480) using addField(), the actual position in the PDF is (X: 36, Y: 643).
Similarly, when placing a button at (X: 2750, Y: 899), it appears at (X: 978.25, Y: 588.59).
The coordinate transformation does not appear to follow a simple linear scale, nor is it reversible (placing a button at a "real" position does not return the expected original value).
Questions:
How does PDF-XChange handle coordinate transformations for interactive fields?
What is the correct formula or method to convert a given (X, Y) position in JavaScript into the actual coordinates used in PDF-XChange?
Is there a way to retrieve the transformed coordinates directly from the software to ensure correct placement?
Thank you for your support!
Best regards,
-
- Site Admin
- Posts: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Issue with Coordinate in PDF-XChange
Hello johan1,
Welcome to our forums.
Normally PDF pages use a carthesian coordinate system with the origin point (0,0) being at the bottom left corner of the page.
Can you please check whether you have the "Bottom up Y axis" turned on: If this option is off - the Editor will display coordinates with the origin being at the top left corner of the page, but the JS code will still use the coordinates as if 0,0 was bottom left.
if it is not that - then maybe your file has been cropped, and the coordinate system has not been normalized. so if you can - please share with us a sample page so that we can check your specific file for you and advise further!
Kind regards,
Stefan
Welcome to our forums.
Normally PDF pages use a carthesian coordinate system with the origin point (0,0) being at the bottom left corner of the page.
Can you please check whether you have the "Bottom up Y axis" turned on: If this option is off - the Editor will display coordinates with the origin being at the top left corner of the page, but the JS code will still use the coordinates as if 0,0 was bottom left.
if it is not that - then maybe your file has been cropped, and the coordinate system has not been normalized. so if you can - please share with us a sample page so that we can check your specific file for you and advise further!
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 5
- Joined: Thu Feb 27, 2025 9:09 am
Re: Issue with Coordinate in PDF-XChange
Hello, Stefan,
Thank you for your response.
I have followed your recommendations:
I enabled the "Bottom up Y axis" option, but the issue persists.
I checked for any cropping on the document, but the PDF has not been cropped.
I tested placing a button via JavaScript with known coordinates, but the output positions are still incorrect.
Here is an example:
I placed a button at (X: 500, Y: 500) using addField().
The actual position in the document appears at (X: 181, Y: 173).
It seems that PDF-XChange applies a transformation to the coordinates, but I cannot determine the exact conversion formula.
Questions:
What transformation does PDF-XChange apply to interactive fields placed via JavaScript?
How can I ensure that the coordinates I enter in JavaScript match the displayed coordinates in the document?
Is there a way to retrieve the transformed coordinates to apply a correction?
If needed, I can provide a sample PDF file to illustrate the issue.
Thank you for your help!
Best regards,
johan
Thank you for your response.
I have followed your recommendations:
I enabled the "Bottom up Y axis" option, but the issue persists.
I checked for any cropping on the document, but the PDF has not been cropped.
I tested placing a button via JavaScript with known coordinates, but the output positions are still incorrect.
Here is an example:
I placed a button at (X: 500, Y: 500) using addField().
The actual position in the document appears at (X: 181, Y: 173).
It seems that PDF-XChange applies a transformation to the coordinates, but I cannot determine the exact conversion formula.
Questions:
What transformation does PDF-XChange apply to interactive fields placed via JavaScript?
How can I ensure that the coordinates I enter in JavaScript match the displayed coordinates in the document?
Is there a way to retrieve the transformed coordinates to apply a correction?
If needed, I can provide a sample PDF file to illustrate the issue.
Thank you for your help!
Best regards,
johan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 5
- Joined: Thu Feb 27, 2025 9:09 am
Re: Issue with Coordinate in PDF-XChange
Hello,
To verify that the issue is not related to my specific document, I tested the script on another random PDF file. However, the coordinates are still not respected, and the problem persists.
This suggests that the transformation of coordinates is applied systematically by PDF-XChange, regardless of the document used.
Could you please clarify how the software processes and modifies the coordinates for interactive fields placed via JavaScript?
Thank you for your help.
Best regards,
To verify that the issue is not related to my specific document, I tested the script on another random PDF file. However, the coordinates are still not respected, and the problem persists.
This suggests that the transformation of coordinates is applied systematically by PDF-XChange, regardless of the document used.
Could you please clarify how the software processes and modifies the coordinates for interactive fields placed via JavaScript?
Thank you for your help.
Best regards,
-
- User
- Posts: 1678
- Joined: Sat Sep 11, 2021 5:04 am
Re: Issue with Coordinate in PDF-XChange
Hello johan1,
As far as I can see from your image, you have set the units to millimeters, but the units for coordinates in PDF JavaScript are basically points (pt.).
If you use points as the unit of measurement and are aware of where the coordinates you are looking at are located on the object, you should be able to understand it better. Once a form field is selected, the coordinate display grid for the object will be grayed out and the box will not be selectable. Therefore, it is best to select the desired coordinates from the nine boxes in the grid by selecting a comment object or other object beforehand, and then select the form field.
Best regards,
rakunavi
As far as I can see from your image, you have set the units to millimeters, but the units for coordinates in PDF JavaScript are basically points (pt.).
Also, in addField(), you have specified (X: 500 pt, Y: 500 pt) as the upper left coordinate, but you are probably looking at a value of (X: 181 mm, Y: 173 mm), which is the center coordinate of the field object in the Arrange tab (Organiser tab in French).
Code: Select all
var testPositions = [
{ name: "Test_3", x: 500, y: 500 } // Centre du plan
];
for (var i = 0; i < testPositions.length; i++) {
var r = testPositions[i];
// 📌 Placement direct sans transformation
var posX = r.x;
var posY = r.y;
// 📌 Créer un bouton interactif de test
var bouton = this.addField(r.name, "button", 0,
[posX, posY, posX + 30, posY - 15]); // Taille augmentée pour visibilité
bouton.textsize = 8;
bouton.borderColor = color.blue; // Encadré en bleu pour bien le voir
bouton.fillColor = color.transparent;
bouton.textColor = color.black;
bouton.value = r.name;
}
// 📌 Message final
app.alert( "Boutons de test placés. Verifie où ils apparaissent et note leurs coordonnées !");
- Product Manuals » PDF-XChange Editor V10 » Tabs Guide » Arrange Tab
https://help.pdf-xchange.com/pdfxe10/in ... ge_ed.html
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
-
- User
- Posts: 5
- Joined: Thu Feb 27, 2025 9:09 am
Re: Issue with Coordinate in PDF-XChange
Hello Rakunavi ,
Thank you very much for your detailed explanation and guidance regarding the coordinate system in PDF-XChange. Your insights helped me understand the conversion issue between millimeters and points, and I was able to successfully apply the correct transformations in JavaScript.
I appreciate your time you took to clarify this for me. It has been extremely helpful in advancing my project!
Best regards,
Johan1
Thank you very much for your detailed explanation and guidance regarding the coordinate system in PDF-XChange. Your insights helped me understand the conversion issue between millimeters and points, and I was able to successfully apply the correct transformations in JavaScript.
I appreciate your time you took to clarify this for me. It has been extremely helpful in advancing my project!
Best regards,
Johan1
-
- User
- Posts: 1678
- Joined: Sat Sep 11, 2021 5:04 am
Re: Issue with Coordinate in PDF-XChange
Hello johan1, thank you for your feedback.
You are welcome. The additional information you have provided has helped me to understand your situation.
I hope your project goes well.
@PDF-XChange Support
As mentioned above, for form fields, the coordinate grid boxes and each coordinate and size are all grayed out and cannot be changed, but it might be more useful to allow the left-hand coordinate grid boxes to be changed without being grayed out.
rakunavi
You are welcome. The additional information you have provided has helped me to understand your situation.
I hope your project goes well.
@PDF-XChange Support
As mentioned above, for form fields, the coordinate grid boxes and each coordinate and size are all grayed out and cannot be changed, but it might be more useful to allow the left-hand coordinate grid boxes to be changed without being grayed out.
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: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Issue with Coordinate in PDF-XChange
Hello rakunavi,
Thanks for the help!
@johan1 - the points used in PDF files are normally 72 points per inch.
So 1 point would be 0.352(7) mm
@Rakunavi - the fields seem to be defined by their top left corner coordinate and then width and height from there: And that is probably why the Transform does not work for form fields. I will check with our devs now whether this can be changed in a future version.
Kind regards,
Stefan
Thanks for the help!
@johan1 - the points used in PDF files are normally 72 points per inch.
So 1 point would be 0.352(7) mm
@Rakunavi - the fields seem to be defined by their top left corner coordinate and then width and height from there: And that is probably why the Transform does not work for form fields. I will check with our devs now whether this can be changed in a future version.
Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.
-
- User
- Posts: 1678
- Joined: Sat Sep 11, 2021 5:04 am
Re: Issue with Coordinate in PDF-XChange
Hello Stefan, thank you for your comment.
This time, johan1 was probably looking at the X/Y coordinates of the center of the object displayed in the Transformer toolbar, but even if you tried to click on another box to see the coordinates of another of the 9 coordinate boxes, it was grayed out and you could not select the box.
Currently, as mentioned above and as shown in the video below, once you have selected a comment object, etc., you must select the desired coordinate box from the Arrange tab, select the field object, and then open the Arrange tab. In the form field properties, I can see the X/Y coordinates of the upper left corner of the object, but to see the X/Y coordinates of any other coordinate box, I seem to have no choice but to repeat the comment selection and form field selection, as shown in the video.
Please give my best regards to the developer.
Best regards,
rakunavi
This time, johan1 was probably looking at the X/Y coordinates of the center of the object displayed in the Transformer toolbar, but even if you tried to click on another box to see the coordinates of another of the 9 coordinate boxes, it was grayed out and you could not select the box.
Currently, as mentioned above and as shown in the video below, once you have selected a comment object, etc., you must select the desired coordinate box from the Arrange tab, select the field object, and then open the Arrange tab. In the form field properties, I can see the X/Y coordinates of the upper left corner of the object, but to see the X/Y coordinates of any other coordinate box, I seem to have no choice but to repeat the comment selection and form field selection, as shown in the video.
Please give my best regards to the developer.
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: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Issue with Coordinate in PDF-XChange
Hello rakunavi,
Ha! An interesting video indeed! I didn't know you can change the point for which you get the coordinates even when the "Arrange" options are greyed out! It will be an interesting discussion on that one with our devs! I will let you know how our conversation went as soon as I can!
Kind regards,
Stefan
Ha! An interesting video indeed! I didn't know you can change the point for which you get the coordinates even when the "Arrange" options are greyed out! It will be an interesting discussion on that one with our devs! I will let you know how our conversation went as soon as I can!
Kind regards,
Stefan
-
- User
- Posts: 5
- Joined: Thu Feb 27, 2025 9:09 am
Re: Issue with Coordinate in PDF-XChange
Hello,
Thank you for your response.
Indeed, I was initially using the coordinates from the center of the object. However, after switching to the top-left corner coordinates, I was able to adjust the positioning so that the button is placed exactly where I want it.
Since this adjustment process will be repetitive, I would like to automate it to ensure consistency and efficiency.
That's why I'm using JavaScript. Thank you all.
Best regards,
Thank you for your response.
Indeed, I was initially using the coordinates from the center of the object. However, after switching to the top-left corner coordinates, I was able to adjust the positioning so that the button is placed exactly where I want it.
Since this adjustment process will be repetitive, I would like to automate it to ensure consistency and efficiency.
That's why I'm using JavaScript. Thank you all.
Best regards,
-
- Site Admin
- Posts: 19868
- Joined: Mon Jan 12, 2009 8:07 am
Re: Issue with Coordinate in PDF-XChange
Hello johan1,
I spoek with our dev team about the request, and it turned out that this will have to be rejected. Form fields are defined with just one coordinate point, so allowing their "transformation" is not yet planned. I know that Rakunavi showed how you can get the coordinates of other points in that rectangle, but allowing those 9 buttons to be active would require other features to also be activated, which are not really supported by form fields. So these menu options will remain inactive for forms: Kind regards,
Stefan
I spoek with our dev team about the request, and it turned out that this will have to be rejected. Form fields are defined with just one coordinate point, so allowing their "transformation" is not yet planned. I know that Rakunavi showed how you can get the coordinates of other points in that rectangle, but allowing those 9 buttons to be active would require other features to also be activated, which are not really supported by form fields. So these menu options will remain inactive for forms: Kind regards,
Stefan
You do not have the required permissions to view the files attached to this post.