Need Javacript Code to make all text bold

New Here ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

I am almost there.  I have Adobe Acrobat DC.

I can bring up the Java Console.

My file name is test.pdf

The text of about 100 pages is extremely light.

I can't figure out which code to put in the box so that it will turn all of my text to bold after hitting CTL + Enter.

I am very new at this.

Thank You for ANY help or DIRECTION you can provide.

TOPICS
Acrobat SDK and JavaScript, Macintosh, Windows

Views

507

Likes

Translate

Translate

Report

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

Most Valuable Participant , Jan 09, 2018 Jan 09, 2018
No. That code was written for an HTML page. It can't be used for a PDF file.

Likes

Translate

Translate
Adobe Community Professional ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

You're not almost there. You aren't even close. Unfortunately, Acrobat JavaScript can't change the PDF page content. It's just not possible.

Likes

Translate

Translate

Report

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 ,
Jan 08, 2018 Jan 08, 2018

Copy link to clipboard

Copied

So, you are saying nothing from the below can be used???:

<html>

<head>

<script language="JavaScript"><!--

function bold(id) {

  if (document.getElementById) {

  document.getElementById(id).style.fontWeight = 'bold';

  }

  else if (document.all) {

  document.all[id].style.fontWeight = 'bold';

  }

}

//--></script>

<p id="myPara">

some sample text <span id="mySpan">this bit will turn bold</span> but this won't.

</p>

<form>

<input type="button" value="bold" onClick="bold('mySpan')">

</form>

</body>

</html>

Likes

Translate

Translate

Report

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
Most Valuable Participant ,
Jan 09, 2018 Jan 09, 2018

Copy link to clipboard

Copied

No. That code was written for an HTML page. It can't be used for a PDF file.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jan 09, 2018 Jan 09, 2018

Copy link to clipboard

Copied

LATEST

There's a very good article at the link below that describes the JavaScript Core vs. Browser JavaScript vs. Acrobat JavaScript.

Learning to Program JavaScript for Adobe Acrobat - KHKonsulting LLC

Likes

Translate

Translate

Report

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