Skip to main content
Participant
January 9, 2018
Answered

Need Javacript Code to make all text bold

  • January 9, 2018
  • 1 reply
  • 1303 views

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.

This topic has been closed for replies.
Correct answer try67

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

1 reply

Joel Geraci
Community Expert
Community Expert
January 9, 2018

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.

mholmansrAuthor
Participant
January 9, 2018

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>

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 9, 2018

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