Tool: Override dimension text

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

Post Reply
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Tool: Override dimension text

Post by Mathew »

Often I want to put my own text into a dimension line, or adjust the number for markups. I don't think PDF-XCE allows one to edit it directly (?) I'm not sure if there's another way, but here's a tool I use to change it.

I also added two options:
  1. option to try to scale the dimension to the entered dimension. It generally works fine with imperial ft-in dimensions also. So if the dimension is 1.487m and you want it to read 1.5m it can adjust the length of the dimension so that it is actually 1.5m (scaled);
  2. option to change the text color to the same color as the dimension lines
image.png
image(1).png
It adds a toolbar button to the Add-on Tools. In the ribbon UI it adds a button at the end of the measuring tools in the Comment ribbon, in the classic UI it adds a menu item "Dim Override…" to "Add-in Tools" in the Tools menu.

Extract the zip and save in the Javascripts folder either in the application folder, or in %APPDATA%\Tracker Software\PDFXEditor\3.0\Javascripts
dimText v1.3.zip
(4.06 KiB) Downloaded 33 times

Note that if you stretch the dimension, then PDF-XChange will override your text.

Translations
This tool is translatable with 1ang.js. Currently I only have machine translation to German in the translation file. The tool posted here will help adding translations if you want to add a language :wink: . Here's the translation file and 1ang.js - save both in the Javascripts folder:
translationData.dimText.json.zip
(3.23 KiB) Downloaded 20 times
Last edited by Mathew on Thu Apr 10, 2025 12:07 am, edited 7 times in total.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19794
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Tool: Override dimension text

Post by Stefan - PDF-XChange »

Hello Mathew,

In the past it was possible to e.g. double click the measurement of the dimension line, and then change the text in the pop-up bubble.
This was causing some problems - so now you can have a "Label" on top of the actual measurement:
image.png
However you can not remove/hide the measurement itself with just the UI.

So many thanks for sharing your tool!

Kind regards,
Stefan
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

I made a few updates to this tool:
  • I changed the icon to 40x40 so it shows a bit better on the ribbon UI
  • It's now translatable with the 1ang function (I've pasted the translation strings below) on the domain 'dimText'
  • I added an option to scale the dimension. This is useful to round off a dimension if measuring gets some small fractions on it:
    image.png
    so that instead of overriding the text, it actually changes the dimension length to read the entered dimension:
    image(1).png
    and the measured distance is correct:
    image(2).png
    image(2).png (5.49 KiB) Viewed 2818 times
DimText v1.0.zip
(3.17 KiB) Downloaded 66 times
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

These are the translatable strings in case anyone wants to. See post about 1ang for more info: viewtopic.php?p=182242#p182242

Code: Select all

{
 "": {
     "Dimension Text Override…\n────────────────────────\nOverride the dimension text on a dimension.": "",
     "Dim Override…": "",
     "Change Dimension Text": "",
     "Elements to change:": "",
     "Current Selection": "",
     "All dimension lines on this page": "",
     "Change text: ": "",
     "Try to scale the dimension": "",
     "Change text color to match line color": "",
     "Nothing Selected": ""
 }
}
Last edited by Mathew on Tue Dec 24, 2024 5:53 pm, edited 1 time in total.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10897
Joined: Wed Jan 03, 2018 6:52 pm

Tool: Override dimension text

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

I fixed some bugs and added to the ribbon UI at the end of the measuring tools under Comment:
image.png
image.png (1.63 KiB) Viewed 2125 times
dimText v1.1.zip
See first post for detailed instructions
(3.58 KiB) Downloaded 50 times
Changes in v1.1
  • Fix regex to deal properly with fraction ft in (ie 4ft 1/8in),
  • fix lint errors,
  • add to ribbon UI
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10897
Joined: Wed Jan 03, 2018 6:52 pm

Re: Tool: Override dimension text

Post by Daniel - PDF-XChange »

Hello, Mathew

Glad to see it, we appreciate you tackling some of these features (Especially ones like this, which "kind of sort of" break the specification, and we could not offer if we wanted to).

Kind regards,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
PDFan
User
Posts: 14
Joined: Tue Jan 07, 2025 1:54 pm

Re: Tool: Override dimension text

Post by PDFan »

Hello Mathew,

thank you for developing this tool! It's exactly that what I have been looking for. Especially the option to scale the dimension is very useful. But unfortunately this option doesn’t work on my computer (Windows 10, German version) as you described above. For example, I have a dimension with length 3.94 m. Then I apply this tool to change it to 4 m and choose the option “Try to scale the dimension”. After this I get a changed text “4 m”, but the actual length of the dimension is not adjusted to 4 m, but something different, as following images show. The adjusted length is not the same each time even for the same original length. What could be the reason?

Thanks for helping!
001.png
002.png
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

[edit] I found the issue: German uses commas instead of period, so javascript was rounding off the number 3,94 to 3. I've posted a fix below.

I suspect I messed something up in the code. I'll investigate and post a fix here.
Last edited by Mathew on Sun Jan 12, 2025 4:16 pm, edited 2 times in total.
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

Here's an update that fixes an issue when commas are used as decimal points.
dimText v1.2.zip
See first post for details
(3.78 KiB) Downloaded 36 times
This tool is also translateable using the domain 'dimText'. I've not included the translation files in the zip, but the strings and a link to the process: viewtopic.php?p=182689#p182689

For example, If you have German set as the default language in pdf xchange:
I used google translate to translate the text strings posted above into German. Save the following as a text file with the name 'translationData.dimText.json' into the javascripts folder, and also save the 1ang.js file in the javascripts folder ( from here: viewtopic.php?t=43253)

Code: Select all

{
 "": {
     "Dimension Text Override…\n────────────────────────\nOverride the dimension text on a dimension.": "",
     "Dim Override…": "",
     "Change Dimension Text": "",
     "Elements to change:": "",
     "Current Selection": "",
     "All dimension lines on this page": "",
     "Change text: ": "",
     "Try to scale the dimension": "",
     "Change text color to match line color": "",
     "Nothing Selected": ""
 },
 "DEU": {
     "Dimension Text Override…\n────────────────────────\nOverride the dimension text on a dimension.": "Bemaßungstext überschreiben…\n────────────────────────\nDen Bemaßungstext einer Bemaßung überschreiben.",
     "Dim Override…": "Bemaßungstext überschreiben…",
     "Change Dimension Text": "Bemaßungstext ändern",
     "Elements to change:": "Zu ändernde Elemente:",
     "Current Selection": "Aktuelle Auswahl",
     "All dimension lines on this page": "Alle Bemaßungslinien auf dieser Seite",
     "Change text: ": "Text ändern: ",
     "Try to scale the dimension": "Versuchen Sie, die Bemaßung zu skalieren",
     "Change text color to match line color": "Textfarbe so ändern, dass sie der Linienfarbe entspricht",
     "Nothing Selected": "Nichts ausgewählt"
 }
}
PDFan
User
Posts: 14
Joined: Tue Jan 07, 2025 1:54 pm

Re: Tool: Override dimension text

Post by PDFan »

Hello Mathew,

now both the option to scale the dimension and the German language file work perfectly. Thank you very much for the prompt help!

Kind regards
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19794
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Tool: Override dimension text

Post by Stefan - PDF-XChange »

:)
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

@PDFan You're the first person I know of who's used the language function :)
PDFan wrote: Sun Jan 12, 2025 11:10 am .. and the German language file work perfectly.
PDFan
User
Posts: 14
Joined: Tue Jan 07, 2025 1:54 pm

Re: Tool: Override dimension text

Post by PDFan »

wow!
glad to be the first one :D

005.png
Mathew wrote: Mon Jan 13, 2025 6:24 pm @PDFan You're the first person I know of who's used the language function :)
PDFan wrote: Sun Jan 12, 2025 11:10 am .. and the German language file work perfectly.
Mathew
User
Posts: 563
Joined: Thu Jun 19, 2014 7:30 pm

Re: Tool: Override dimension text

Post by Mathew »

If a dimension had a Label, then the tool was not getting or setting the dimension text properly. Fixed in v1.3.
dimText v1.3.zip
(4.06 KiB) Downloaded 35 times
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19794
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Tool: Override dimension text

Post by Stefan - PDF-XChange »

:)
Post Reply