Solved

How do I put a timestamp on a PDF file each time it is printed..?

Posted on 2004-04-01
7
522 Views
Last Modified: 2010-05-18
i want to fire a  event, when ever there a print there should be a date stamp. I think this can be done using a javascript. though i found a code for it i dont know how to call every time a document is printed.

thnx
0
Comment
Question by:agsingh2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10736819
Which version of Acrobat do you have?
0
 

Author Comment

by:agsingh2000
ID: 10736848
its version 5
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10737192
Open the PDF file that you want to print the time stamp on.
In Acrobat 5 select the menu "Tools>JavaScript>Set Document Actions". This will bring up the "Document Actions" dialog. Here you can assign JavaScript programs to certain events (Document Will Close, Document Will Save, Document Did Save, Document Will Print and Document Did Print).

Select the "Document Will Print" entry and click on "Edit". In the editor, paste the following script:

 for (var i = 0; i < this.numPages; i++)
     {
          // get the crop box for the page
          var aRect = this.getPageBox("Media", i);
          var width = aRect[2] - aRect[0];
          var height = aRect[1] - aRect[3];

          // create the form fields for all pages
          var fieldPos = [width-144, height-72, width, height];
            var f = this.addField(String("Received"), "text", i, fieldPos);
            f.textSize = 12;
            f.textColor = color.blue;
            f.fillColor = color.transparent;
            f.textFont = font.HelvB;
            f.borderStyle = border.s;
           f.strokeColor = color.transparent;
          f.value = stamp;
     }


Then select "Document Did Print", and add the following script:

// remove today's date
for (var i=0; i<this.numPages; i++)
{
    this.removeField("PrintedDate");
}

0
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 

Author Comment

by:agsingh2000
ID: 10743096
i have a similar code, but the problem is i dont want the users to always change the settingsin acrobat reader. Can this be done in some way that its automatic. So irrespetive of pdf document when ever there is a print even this code is fired.
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 10743501
JavaScript only allows this on a per job basis. If you need something that always works, you need to write (or have somebody write) a plug-in. In your last comment you mention Reader. A Reader plug-in unfortunately requires that you get a license from Adobe (either $1000 or $2500, depending on how you will use or distribute the plug-in).
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10898648
Does this answer your question?
0
 

Author Comment

by:agsingh2000
ID: 10900432
not exactly. I had the similar code that you gave me. But it seems that what i want cannot be achieved by javascript.
i am giving you the points for letting me know.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP and Form data to PDF 4 186
SharePoint 2013 open PDF in adobe 5 894
what font behind pdf 32 186
Find fonts in Word 2010 32 76
Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe In a previous Experts Exchange article, How To Rename-Move a Batch of PDF Files Based on Contents of the Files (http://www.experts-exchan…
PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question