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

Highlight text when check box ticked

New Here ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

I have a PDF which has a number of check boxes.

 

I want to be able to either highlight the text next to a check box when the box is selected or bold the text.

 

Example below.

 

Anyone done something similar?

 

Tickbox Highlight.png

TOPICS
Acrobat SDK and JavaScript

Views

2.3K

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
Community Expert ,
Feb 12, 2020 Feb 12, 2020

Copy link to clipboard

Copied

You've got a few different options for doing this.

1)  Use the Highlight annotation to add highlights to all the text that needs to be shown as highlighted. The use a script on the MouseUp event of hte checkbox to toggle the "hidden" property of the associated annotation 

2) Replace text next to checkbox with a readonly text field. Then use the MouseUp script to change the font and/or textbox properties.

3) Replace text next to checkbox with a Text Markup Annotation. Use same MouseUp methodology.

 

 

 

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

Votes

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 ,
Feb 13, 2020 Feb 13, 2020

Copy link to clipboard

Copied

Thanks for your response.

 

I've still had no luck l'm afraid.

 

Do I need to apply the logic to the check box or the text field?

 

I've tried various scripts but still having no success.

 

Do you have any examples?

Votes

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
Community Expert ,
Feb 13, 2020 Feb 13, 2020

Copy link to clipboard

Copied

LATEST

Yes,  you'll need to create a custom script for the checkbox. And a text field is the easiest thing to use. We'll change the background color to make the highlight.

So lets say the text box is named "Line1Text" and the checkbox is "Line1Check"

 

Put this on the MouseUp of the checkbox

 

if(event.target.value != "Off)

    this.getField("Line1Text").fillColor = color.yellow;

else

    this.getField("Line1Text").fillColor = color.transparent;

 

 

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

Votes

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