PDF Editing Issues

How to Add Separate Sender and Recipient Print Dates to a PDF Form

Anum MushtaqAnum Mushtaq Oct 28, 2026 868 views

Question details

The user needs to record the exact date and time a PDF form is printed by the sender, and separately record the print date and time for the recipient, ensuring the sender's original date is not overwritten.

How to Add Separate Sender and Recipient Print Dates to a PDF Form
Product
PDF
Device & OS
not provided
Scenario
Creating a fillable PDF form that tracks accurate printing timestamps for both the document creator and the final recipient without conflicts.
Observed behavior
Using a basic 'Will Print' document script overwrites all date fields every time the document is printed, failing to preserve the sender's original print date.
Before you start

Ensure you are using a desktop PDF editor that supports form field creation and document-level JavaScript execution, as many mobile viewers cannot run these scripts reliably.

Solution 1Recommended

Use Conditional JavaScript for Separate Print Date Fields

Create distinct fields for the sender and recipient, and use a conditional script that checks if the sender's field is empty before applying a date.

By utilizing a conditional statement within your 'Will Print' script, you can ensure that the sender's print date is populated only once. The recipient's print date field can be configured to update every time a subsequent print action is triggered.

1
Create separate text fields

Open your PDF form in editing mode and create two distinct text fields. Name the first one "PrintDate" (for the sender) and the second one "RecipientPrintDate".

2
Access Document JavaScript settings

Navigate to the document's properties or JavaScript settings menu, and locate the document-level "Will Print" event trigger.

3
Add conditional script for the sender

Enter a script that only writes the date if the field is empty: `if (this.getField("PrintDate").value == "") { this.getField("PrintDate").value = util.printd("mm/dd/yyyy HH:MM", new Date()); }`.

4
Add the recipient script

Below the sender's code in the same "Will Print" event, add the script to always update the recipient's field: `this.getField("RecipientPrintDate").value = util.printd("mm/dd/yyyy HH:MM", new Date());`.

5
Test the form behavior

Save the document and print it to PDF to verify the sender date populates. Print it a second time to ensure the sender date remains unchanged while the recipient date updates to the new time.

Use Conditional JavaScript for Separate Print Date Fields
Testing Environment Compatibility: Always test your scripted PDF form in a robust desktop PDF application (like Acrobat or WPS PDF). Many mobile PDF readers lack full JavaScript support and may not trigger the Will Print event.
Professional PDF Editor

Edit and Manage PDF Forms Seamlessly with WPS Office

WPS Office provides a comprehensive suite of PDF editing tools, allowing you to easily create fillable forms, manage text fields, and configure document properties for your daily workflow.

  1. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document you want to edit or turn into a form.
  2. 2. Access Form tools: Navigate to the 'Form' tab on the top ribbon to reveal the form creation and editing tools.
  3. 3. Insert Text Fields: Click on 'Text Field' and click anywhere on the document to place fields for your sender and recipient print dates.
  4. 4. Modify field properties: Right-click the inserted text fields to adjust their properties, such as making them read-only or renaming them for scripting purposes.
Easily insert, align, and customize interactive PDF form fieldsHighly compatible with standard PDF formats and Microsoft Office filesLightweight, fast, and available across Windows, Mac, and mobile devicesUser-friendly interface for effortless document management and formatting
microsoft office alternative - wps office

Frequently Asked Questions

Why isn't my Will Print script working when opened on a smartphone?

Many mobile PDF viewers have limited or no support for JavaScript, which includes document-level events like 'Will Print'. For forms relying on complex scripting, it is highly recommended to instruct users to open and print them on a desktop PDF application.

Can I format the print date differently in the JavaScript code?

Yes, you can customize the date format within the util.printd function. For example, changing the format string from "mm/dd/yyyy HH:MM" to "dd-mmm-yyyy" will output the date in a format like "25-Oct-2023".

How do I prevent users from manually editing the print date fields before printing?

You can protect the fields by opening the text field properties in your PDF editor and enabling the "Read Only" option. This ensures the fields can only be populated by the automated JavaScript trigger, preventing manual keystrokes.