Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to detect font and change font with JavaScript

New Here ,
Dec 19, 2019 Dec 19, 2019

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

 

 

TOPICS
Acrobat SDK and JavaScript
891
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019

None of that is possible with Acrobat JavaScript.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 19, 2019 Dec 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2019 Dec 19, 2019
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines