Solved

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

Posted on 2004-04-01
7
517 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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 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…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 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