In need of a little help. Need a short javascript code chunk to past a custom stamp on the first page of each selected PDF. Want the Stamp to appear in the upper-left hand corner of the page. I have been working with the sample code. For some reason I been unable to change the stamp being applied in the following code:
/* Insert Stamp */
// Get the crop box of the first page
var aCrop = this.getPageBox()
var semiWidth = aCrop[2]/2;
var semiHeight = aCrop[1]/2;
// Get the center of the crop box.
var x = semiWidth;
var y = semiHeight;
// Make the width of the stamp roughly .67% of the cropped page width, and
// make the height of the stamp 25% of the stamp's width
semiWidth = 0.67*semiWidth;
// Make width .67 of width of page
semiHeight = 0.25*semiWidth; // Make height .25 of semiWidth
var Rect = new Array (x-semiWidth,y-semiHeight,x+semiWidth,y+semiHeight);
// The matrix m transforms from rotated to default user space
var m = (new Matrix2D).fromRotated(this,0)
// Transform Rect from rotated to default user space
Rect = m.transform(Rect)
// Now add our annotation using the Rect array for the rect property
var annot = this.addAnnot
({
page: 0,
type: "Stamp",
name: "myStamp",
rect: Rect,
contents: "This document has been approved.",
AP: "Void"
});
You're only easy option is to add a watermark, which looks like a custom stamp, but isn't on an annotation.
But if you want this image to be on a floating window, like the stamp annot, then you could use a button field. Button fields can load an image and be placed by JavaScript in a batch process.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script