These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Placing text on a document that will print in Acrobat

jaalbr
Registered: Jul 6 2007
Posts: 2

I have Acrobat 7.0 (Standard). My job requires me place a large (18 point) file number on the upper right-hand corner of each document I process (hundreds a day). It needs to show up on the document when printed. How can I do this in the least number of steps possible?

Thanks!

J

gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
With Acrobat Standard or Professional,you can add a menu item that can add a field and either prompt you for a value or insert number from a persistent global variable.

Placing the following code in the Acrobat's "JavaScripts" folder will add the "Add Document ID" to the "Document" menu option of your copy of Acrobat's menu bar.


function EnterDocID() {
/*
prompt for user input
*/
var cResponse = app.response({
cQuestion: "Enter Document ID:",
cTitle: "Document ID",
cDefault: "",
cLabel: "Response:"
});
if (cResponse == null) cResponse = "";
return cResponse;
}

function AddDocumentID (cID) {
/*
add field with contents of cID string
*/
// define some constants
var inch = 72; // points per inch
var height = 0.50 * inch;
var width = 2.75 * inch;
var topMargin = 0.25 * inch;
var rightMargin = 0.25 * inch;

// get some page information
var nPage = this.pageNum
// page rotation
var nRotation = this.getPageRotation({nPage: 0});
// page size
var aRect = this.getPageBox({cBox: "Media", nPage: 0});

// computer field location from page information
var fRect= new Array()
// Position a text field upper right corner of page for page rotaion 0
fRect[0] = aRect[2] - width; // width of field from right edge
fRect[1] = aRect[1] - topMargin; // from top edge
fRect[2] = aRect[2] - rightMargin; // from right edge
fRect[3] = aRect[1] - height; // height of field
// add field
var f = this.addField({cName: "nDocumentNumber", cFieldType:"text", nPageNum: 0, oCoords: fRect})
// set some field properties
f.delay = true;
f.alignment = "right"
f.borderStyle = border.s;
f.doNotScroll = true;
f.doNotSpellCheck = true;
f.fillColor = color.ltGray;
f.readonly = true;
f.rotation = nRotation;
f.textSize = 18;// 18 pt.
f.textColor = color.blue;
f.textFont = font.Helv;
f.value = f.defaultValue = cID;
f.delay = false;
return;
}

app.addMenuItem({ cName: "Add Document ID", cUser:"DocID", cParent: "Document",
cExec: "AddDocumentID ( EnterDocID() );",
cEnable: "event.rc = (this.numPages != null);"
});

George Kaiser