Google Doc Print Event

40 views
Skip to first unread message

Mike Daniels

unread,
Oct 4, 2021, 1:32:52 PM10/4/21
to Google Apps Script Community
Hello Everyone,

Long time listener, first time poster.

QUESTION: Is it possible to insert the current date and time in a Google Doc when it printed to a printer or to a PDF format?

I'm trying to understand if an AppScript could be triggered during a print event and have this date time inserted prior to completing printing process.  

This is specifically required to replace a Microsoft Word feature that is used for regulatory requirements.  Thanks in advance for any guidance.

Clark Lind

unread,
Oct 10, 2021, 9:56:26 PM10/10/21
to Google Apps Script Community
It doesn't look like anyone has the answer to this. I'm guessing the answer is "no" since a browser's print function isn't available to Apps Script. However, if you were working with pdf files (in Drive), you could edit them to add the current date/time. There are JS libraries you could use in an apps script project. Look for jsPDF, or PDF-Lib, or Mozilla's PDF.js. Since these run in the browser, you have to basically create an html interface/web app.
Reply all
Reply to author
Forward
0 new messages