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

Javascript Console Acrobat

Community Beginner ,
Jan 12, 2021 Jan 12, 2021

How I Could replace the font for the document in the console of Javascript with commands line? I would like to edit the document and modifing the font that it is Arial for example to other font that it is Calibri. And save the document. But I would like to do this in the command line and over all the document.

TOPICS
Edit and convert PDFs , How to , JavaScript
756
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
1 ACCEPTED SOLUTION
Community Expert ,
Jan 12, 2021 Jan 12, 2021

Not possible with Javascript.

View solution in original post

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 ,
Jan 12, 2021 Jan 12, 2021

Want you change the font of the Javascript console or what?

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 Beginner ,
Jan 12, 2021 Jan 12, 2021

I would like to change the font of the document pdf but not in the edit section, I want to change the font with the console. For example you could change the font that is used when laying out text in a text field or button. But I don't know how I change in a text plain of the pdf and what if the container that contain the text plain of the doc.

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
LEGEND ,
Jan 12, 2021 Jan 12, 2021

Here's a script you can use to set the font of all text fields in the document to something:

 

var i, f;
for (i = 0; i < numFields; i += 1) {
    f = getField(getNthFieldName(i));
    if (f && f.type === "text") {
        f.textFont = "calibri";  // Use font name for Calibri here
    }
}

 

Note that "calibri" in the code above probably isn't correct. so you have to determine the correct name yourself. To do so, you can run the following line of code in the console:

 

getField("Text1").textFont;

 

where "Text1" is the field name of field that you'e set the font to Calibri. When executed, it will return the font name that you can use to set the font of fields to Calibri.

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
LEGEND ,
Jan 12, 2021 Jan 12, 2021

It looks like the correct name is "Calibri", so you can try that.

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 Beginner ,
Jan 12, 2021 Jan 12, 2021

Yes, this is correct and change the font for the fields of a form. But I would like to change the text plain.

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 ,
Jan 12, 2021 Jan 12, 2021

Not possible with 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 Beginner ,
Jan 12, 2021 Jan 12, 2021
LATEST

With C or Java is possible? Thanks.

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