Solved

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

Posted on 2004-04-01
7
511 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
  • 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This article is in response to a question here (http://www.experts-exchange.com/Other/URLs/Q_28283850.html) at Experts Exchange. The Original Poster has a scanned signature and wants to make the background transparent so that the signature may be pl…
Update 21-May-2015: I temporarily removed the source code to make major changes to the program. Regards, Joe INTRODUCTION This article presents a solution to a question (http://www.experts-exchange.com/Programming/Installation/Q_28396542.html)…
In this video, we show how to perform Bates Numbering/Stamping of PDF documents using Power PDF Advanced, the newest product from the Document Imaging division of Nuance Communications. There are two editions of Power PDF — Standard and Advanced. Th…
In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now