Skip to main content
shelbycott
Known Participant
May 14, 2020 3:03 PM UTC
Answered

Retrieve list of fonts via JavaScript

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!

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
May 14, 2020 3:28 PM UTC

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 PDFScriptingUse the Acrobat JavaScript Reference early and often

6 replies

Thom Parker
Community Expert
Community Expert
May 14, 2020 3:59 PM UTC

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

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
May 14, 2020 3:28 PM UTC

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. 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
shelbycott
Known Participant
May 14, 2020 3:59 PM UTC

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

Translate
Bernd Alheit
Community Expert
Community Expert
May 14, 2020 3:07 PM UTC

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

Translate
shelbycott
Known Participant
May 14, 2020 3:08 PM UTC

Yes, correct.

Translate
Bernd Alheit
Community Expert
Community Expert
May 14, 2020 3:41 PM UTC

Not possible with Acrobat Javascript.

Translate