Skip to main content
Participant
December 19, 2019
Question

How to detect font and change font with JavaScript

  • December 19, 2019
  • 1 reply
  • 1072 views

Hello to all,

 

I'd like your help in how to get the font name and size of the selected text and then change the font name and color of all words with that font name and font size using JavaScript.

 

Below is a kind of pseudocode what I thought.

 

For example:

var f = this.selectedtext.fontname

var s = this.selectedtext.fontsize

 

for each word with font f and s{

  word.fontname = "Helvetica"

  word.fontcolor = blue

}

 

Thanks in advance for any help

 

 

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
December 19, 2019

None of that is possible with Acrobat JavaScript.

cegcastAuthor
Participant
December 19, 2019

Thanks for answer.

 

I have issues because I want to remove all Bibliography references at the bottom of each page. I could do it converting to MS Word but when I convert it, is has several fonts and sizes that match with the text that I want to preserve.

 

Do you know how could I do this?

try67
Community Expert
Community Expert
December 19, 2019

If it's always at the bottom of the page, and isn't anything else in that area, you could use a script that adds a Redaction annotation over the same area of each page, and then applies it to remove the text from it.