Copy link to clipboard
Copied
I'm adding text to an existing pdf document where I am trying to match the font already used. The existing objects do not seem to be standard text comments that I can edit.
As a result I am using "Add Text Comment" using the Helvetica font.
However the smallest font size I can select is 6, and this is still larger than the font I am trying to match. I can't simply type another number in the size box like i can with MS Word.
How do I reduce the size further, probably 5 will be sufficient, maybe 4?
The sheet is currently A4, and I was wondering if I could increase the paper size where it all might scale and size 6 might then be fine. Is this possible?
Any help would be appreciated
Copy link to clipboard
Copied
Do not select the text in the comment, but the comment itself, via the Comments List panel.
Copy link to clipboard
Copied
It can be done using a script. Select the comment with the mouse, press Ctrl+J, paste this code into the Console window that opens, select all of it using the keyboard/mouse and press Ctrl+Enter:
var rc = this.selectedAnnots[0].richContents;
var s0 = rc[0];
s0.textSize=4;
var newRc = [s0];
this.selectedAnnots[0].richContents = newRc;
Copy link to clipboard
Copied
Many thanks for your reply.
When I first typed Ctrl+J I got a JavaSript Debugger window where all elements were empty.
I presume this has to be enabled in Edit > Preferences > JavaScript > Enabled JavaScript debugger after Acrobat is restarted.
If I add text through Fill and Sign Tools > Add Text etc,after Ctrl-J I now get a JavaSript Debugger window with a tree called Bookmark in 'Scripts'.
If I copy your script and press Ctrl-Enter, nothing happens.
What am I doing wrong?
Copy link to clipboard
Copied
Did you select the entire code before pressing Ctrl+Enter?
Copy link to clipboard
Copied
Yes.
In a further attempt I copied and pasted via Notepad++, to make sure only ascii was copied.
Copy link to clipboard
Copied
And what was the result, exactly? Did some message appear in the console after you ran the script?
Copy link to clipboard
Copied
Take a look at this tutorial for the JavaScript console in Acrobat: https://acrobatusers.com/tutorials/javascript_console
Are you using the Windows version of Acrobat? If you are on a Mac, you would use the Cmd key.
Copy link to clipboard
Copied
First of all I now have the correct boxes ticked as per article.
I highlighted the text in question using and got the Add Text Comment Box.
Ctrl-J to get the JavaScript Debugger.
I pasted the script into the Console window, selected the script, and then entered Ctrl-Enter
This is the final window:
var rc = this.selectedAnnots[0].richContents;
var s0 = rc[0];
s0.textSize=4;
var newRc = [s0];
this.selectedAnnots[0].richContents = newRc;
TypeError: this.selectedAnnots is undefined
1:Console:Exec
undefined
Copy link to clipboard
Copied
This usually means that you did not actually select an annotation, so the selectedAnnots property of the current document not undefined. Make sure that your text box is actually selected before you run the script.
Copy link to clipboard
Copied
Do not select the text in the comment, but the comment itself, via the Comments List panel.
Copy link to clipboard
Copied
Many thanks, now sorted.
As you may gather I don't often edit documents in Acrobat!
Is there any reason why I can't do this directly?
Many thanks to all those who have had an input to this topic.
Copy link to clipboard
Copied
Thank you for the question and the reply that helped me too.
After changing the font size to 2 pt, I would like to reduce the line spacing of the text comment box to match the font size; but the minimum spacing I get with the tool button "reduce line spacing" reaches its minimum spacing at level that is roughly four times too much. Can anybody help me to do similar adjustment to the linespacing via javascript?
Copy link to clipboard
Copied
I couldnt get the advise below to work but I found that if you go to edit mode and insert text, you can change the font size there rather than messing around with javascript. Hope this helps anyone with the same problem in the future.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now