PDF Editing Issues

How to Hide Sample Form Text When Printing a PDF

Huma Ashraf ChHuma Ashraf Ch Nov 3, 2026 869 views

Question details

The user wants to keep instructional or sample text visible on the screen for a PDF form, but prevent it from appearing when the document is printed, unless actual data has been entered.

How to Hide Sample Form Text When Printing a PDF Form
Product
PDF Editors
Device & OS
not provided
Scenario
Preparing a fillable PDF form that contains default instructional text to guide users, which needs to be excluded from the final printed output if the field is left untouched.
Observed behavior
Currently, the default sample text prints along with the rest of the form, which clutters the printed document if the user leaves the field blank.
Before you start

Ensure you have a PDF editor that supports document-level JavaScript and form field properties, and that your form fields already have their default values properly assigned.

Solution 1Recommended

Use Document-Level JavaScript for Print Events

By adding a script to the 'Will Print' and 'Did Print' events, you can automatically hide unmodified fields during printing and restore them afterward.

This method uses a small script to loop through all form fields. If a field's current value is the same as its default instructional text, the script temporarily sets its display property to 'noPrint'. After printing, another script restores its visibility.

1
Access Document JavaScripts

Open your PDF editor, navigate to the Tools or Form menu, and select Document JavaScripts or Document Actions.

2
Add a 'Will Print' Script

Create a new script triggered by the 'Will Print' event. Enter a loop that compares each field's current value to its default value. If they match (and the field is not a button), set the field's display property to display.noPrint.

3
Add a 'Did Print' Script

Create a second script triggered by the 'Did Print' event. Loop through the fields again and set the previously hidden fields back to display.visible so the sample text returns on screen.

4
Save and Test

Save your PDF document and perform a test print. Verify that fields containing the sample text are blank on the printed page, while fields with custom input print normally.

Use Document-Level JavaScript for Print Events
Exclude Buttons: Make sure your script excludes button fields (like submit or reset buttons) in the loop so they don't behave unpredictably during the print process.
Edit PDF Forms Easily

Manage PDF Forms and Print Settings with WPS Office

WPS Office provides a comprehensive PDF editor that allows you to easily create, edit, and fill interactive PDF forms, along with precise control over printing options.

  1. 1. Open your PDF in WPS: Launch WPS Office and open your PDF form using the WPS PDF editor.
  2. 2. Edit Form Properties: Navigate to the 'Form' tab to access interactive form tools. Right-click any form field and select 'Properties' to adjust visibility settings or default values.
  3. 3. Print with Custom Settings: Go to Menu > Print to access advanced printing settings, where you can choose to print the document with or without form fields.
Create and edit interactive fillable PDF forms effortlesslyControl form field visibility and print behaviorHigh compatibility with standard PDF formats including Adobe Acrobat formsLightweight and user-friendly interface for all your PDF and Office needs
microsoft office alternative - wps office

Frequently Asked Questions

Can I hide specific form fields from printing without using JavaScript?

Yes. Most advanced PDF editors allow you to right-click a form field, go to Properties, and under the General tab, set the 'Form Field' visibility to 'Visible but doesn't print'. This permanently hides the field from printing regardless of its content.

Why did my hidden sample text still print?

This usually happens if the JavaScript wasn't triggered properly, or if the PDF viewer being used to print the document doesn't support document-level JavaScript. Ensure you are using a fully featured PDF reader and that JavaScript is enabled in the software settings.

How do I set a default value for a PDF form field?

In form editing mode, double-click the text field to open its Properties dialog. Go to the Options tab and enter your instructional text into the 'Default Value' box.