PDF Printing Issues

Fix Incorrect AM/PM Time Format in PDF Will Print Action

Bushra ParveenBushra Parveen Nov 5, 2026 868 views

Question details

The user needs to correct an issue where a PDF's JavaScript displays the wrong AM/PM indicator during a print action.

How to Fix Incorrect AM/PM Format in PDF Will Print Action
Product
Adobe Acrobat / Chrome PDF Viewer
Device & OS
not provided
Scenario
Executing JavaScript to populate a 12-hour time format field during a PDF 'Will Print' action.
Observed behavior
The 12-hour format and AM/PM indicators display correctly when saving the document, but the AM/PM value becomes incorrect when printing the file through Google Chrome.
Before you start

Ensure your JavaScript code accurately utilizes standard date and time formatting methods before investigating browser-specific rendering bugs.

Solution 1Recommended

Print Using a Dedicated Desktop PDF Application

Bypass browser plugin limitations by opening and printing the interactive PDF using a native desktop PDF reader.

Google Chrome's built-in PDF viewer uses a different JavaScript rendering engine than dedicated PDF software. This often leads to misinterpretations of specific Acrobat JavaScript methods, such as date object formatting during the 'Will Print' event.

1
Download the PDF

Save the PDF file from Google Chrome to your local hard drive instead of printing it directly from the browser window.

2
Open with a Desktop App

Right-click the downloaded PDF file, select 'Open with', and choose a dedicated application like Adobe Acrobat, Acrobat Reader, or WPS PDF.

3
Execute the Print Action

Click the 'Print' icon or press Ctrl+P. The native software will correctly process the 'Will Print' JavaScript, ensuring the AM/PM format remains accurate.

Print Using a Dedicated Desktop PDF Application
Reliable Script Execution: Desktop PDF readers fully support Acrobat JavaScript extensions, meaning automated time stamps and form scripts will function identically during both 'Will Save' and 'Will Print' actions.

Print Interactive PDFs Reliably with WPS PDF

Avoid unpredictable browser-based JavaScript errors by managing your interactive PDF forms directly in WPS Office. WPS PDF offers native handling of form actions and scripts, ensuring time formats are printed flawlessly.

  1. 1. Open Your PDF in WPS: Launch WPS Office and open the PDF document containing your custom time-formatting JavaScript.
  2. 2. Verify the Document: Check that any dynamic fields display the correct initial 12-hour format and AM/PM values.
  3. 3. Trigger the Print Menu: Click the Print icon on the top toolbar or press Ctrl+P to open the print dialog and trigger the 'Will Print' script.
  4. 4. Print the Document: Select your physical printer or 'Print to PDF' and click 'Print'. WPS PDF will correctly process the script and output the accurate time.
Accurately processes 'Will Print' and 'Will Save' document actionsFully compatible with standard Adobe Acrobat PDF formats and formsLightweight, fast, and free alternative to heavy PDF editorsIntuitive print preview ensures output matches your screen exactly
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Acrobat JavaScript work when saving but fail when printing in Chrome?

When you save a PDF, the action is usually executed by the native software's engine. When printing from Google Chrome, the action relies on Chrome's built-in PDF rendering plugin, which may misinterpret specific JavaScript date and time string conversions during the print spooling phase.

How do I correctly format a 12-hour clock with AM/PM in Acrobat JavaScript?

You can use the built-in utility method `util.printd("h:MM tt", new Date())` within Acrobat JavaScript. This securely formats the current date object into a 12-hour time string with the correct AM or PM indicator.

Can I force Google Chrome to use a desktop app for printing PDFs?

Yes. You can bypass the Chrome PDF viewer entirely by going to Chrome Settings > Privacy and security > Site Settings > Additional content settings > PDF documents. Select 'Download PDFs' to force the browser to download the files so they can be opened and printed in a dedicated desktop app like WPS PDF.