I am trying to batch add stamps to the bottom right corner of a large number of files. The stamp only needs to include the filename (minus the file extension) and one value to be entered by the user at the start of the action. I see documentation to add the standard stamp and in the position I want, but I can't seem to get the dynamic stamp name to insert that in a batch.
My ultimate goal is to add a small amount of white space to the bottom of the first page of each document, insert the stamp with the user info and filename, flatten the pdf, and scale the document back to 8.5" x 11". Is this something I'll be able to actually get to?
The document file name is the "documentFileName" property of the document object.
In a stamp script the document object being stamped is in "event.source.source" property
So your stamp script could look like this:
event.value = event.source.source.documentFileName.replace(/\.pdf$/i,"");
I haven't tested this in a batch process, but it will work in a regular dynamic stamp. But it should also work when the stamp is applied inside a batch processing script.
HI Thom, thanks for the reply!
So my actual issue is finding a way to call the custom stamp during the Adobe action process. I can't seem to get the stamp name for each individual file without first placing the stamp. I spent most of the day yesterday and decided maybe a FreeText annotation would work better than a dynamic stamp.
The issue I am running into now is once i add the space for the footer and FreeText annotation, how do i "burn in" the annotation and resize the page back to 8.5" x 11" is that something that can be done through the script or do i have to manually print each file to the virtual PDF printer and choose the fit option? I am trying to automate this process as much as possible.
The stamp name never changes. Its always the same. But a free text annot works great and it's easy if all you want is text. Stamps are better if any graphics are involved.
You can flatten the document after applying the text annots.
So down to business. Yes, the easiest way to scale a PDF page is to print the doc to a file. This also flattens all interactive content. This does not always work when printing to a PDF. But since you are specifically scaling the PDF it might work. If not, print to PostScript, then open the post script file to convert it back to PDF.
i'm trying to automate this task as much as possible. basically i want to put a larger freetext box on the first page in newly added white space at the bottom so that none of the content of the document is covered by the freetext, and page numbers on all of the rest of pages also in newly created white space at the bottom and then flatten and resize the whole thing back to 8.5 x 11 and flatten. Printing each file to PDF after the process completes each time I do this seems a bit cumbersome, but it sounds like scaling the pages down through a script is also a bit tedious. Can you point me in the right direction on that?
Yes, scaling a PDF is cumbersome. The Acrobat JS model has no built-in features for this, so you have to find a creative way to get around it. And I already told you how to do it. Look in the Acrobat JS Reference for the PrintParams object.
Look at the example for the "fileName" property, here:
There are a couple of other ways to scale PDF pages. Both requires creating a new document with exactly the same number of pages, but blank. Then you apply the content of the original to the new blank page as either a watermark or a button. Both of these mechanisms control the scaling.