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

Retrieve list of fonts via JavaScript

Explorer ,
May 14, 2020 May 14, 2020

Hi everyone!

 

I'm not too hopeful about this one, but is there a way to retrieve a list of installed fonts available for use in Acrobat via JavaScript? Something similar to app.fonts in Extendscript?

 

I know this can probably be done with a Java library like PDFBox, but I wanted to make sure there's no way to achieve this with JavaScript before I go down that wormhole. I realize this might not be possible though.

 

Any push in the right direction is greatly appreciated. Thanks so much!

TOPICS
Acrobat SDK and JavaScript
2.6K
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

correct answers 1 Correct answer

Community Expert , May 14, 2020 May 14, 2020

No, the installed fonts are not available to the Acrobat JavaScript model. This would be a great feature though. 

You can use any installed font if you already know the language independent name. The process for gettting the name is to set it in a form field, then acquire it with JavaScript in the console.  A bit laborious for creating a large list, but enough to build a small one.

 

I don't know if there is a relationship between the HTML font names and the ones used in Acrobat, but if there is

...
Translate
Community Expert ,
May 14, 2020 May 14, 2020

Want you a list of the installed fonts on the system?

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
Explorer ,
May 14, 2020 May 14, 2020

Yes, correct.

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 ,
May 14, 2020 May 14, 2020

Not 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
Community Expert ,
May 14, 2020 May 14, 2020

No, the installed fonts are not available to the Acrobat JavaScript model. This would be a great feature though. 

You can use any installed font if you already know the language independent name. The process for gettting the name is to set it in a form field, then acquire it with JavaScript in the console.  A bit laborious for creating a large list, but enough to build a small one.

 

I don't know if there is a relationship between the HTML font names and the ones used in Acrobat, but if there is one, then you could just create an array of names in a browser console and copy it into an Acrobat script. 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Explorer ,
May 14, 2020 May 14, 2020

Perfect, I actually think this workaround could work in my case. Thank you so much—appreciate the help!

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 ,
May 14, 2020 May 14, 2020
LATEST

If you want this to be done purely in the Acrobat environment, then you'll need to use a plug-in.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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