Every year we need to print off hundreds of enrolment forms to verify details of new students and current students. Each of these forms is pre-filled with students details and there is a separate PDF for each student.
Previously I used Multiple PDF Printer but this no longer works with Acrobat X. Instead I created an Action Wizard that allows you to select the folder with all the PDFs and it will print them all to your default printer with the default settings.
I then added another step to the action that uses Javascript to extract the student’s name from the file name and added it as a header to each page of that file. Finally this was modified so that the name is always on the outer edge, when it is printed back to back and stapled on the left.
To create this you can follow the following directions or import the attached action.
Print Ghost Enrolment Forms with Header (960 bytes, 3,697 hits)
In Acrobat X:
- File -> Action Wizard -> Create New Action
- Click More Tools and then click Execute JavaScript and then click Print.
- Change Start with to Ask when Action is Started
- Click on the Options button for JavaScript and paste in the following:
var strFilename = this.documentFileName; // A regular expression to acquire the base name of the file // Removes everything before last underscore for Ghosted_EnrolmentForm_ var re = /.*\/|.*_|\.pdf$/ig; // Get student name by stripping path and everything to left of underscore var strFilename = strFilename.replace(re,"").replace(",",", "); var pageAmount = this.numPages; // Finds the length of the PDF for (i = 0; i { if (i % 2 == 0) { // Odd this.addWatermarkFromText({ cText: strFilename, nStart: i, nEnd: i, nFontSize: 11, nTextAlign: app.constants.align.right, nHorizAlign: app.constants.align.right, nVertAlign: app.constants.align.top, nHorizValue: -28, nVertValue: -10 }); } else { // Even this.addWatermarkFromText({ cText: strFilename, nStart: i, nEnd: i, nFontSize: 11, nTextAlign: app.constants.align.left, nHorizAlign: app.constants.align.left, nVertAlign: app.constants.align.top, nHorizValue: 28, nVertValue: -10 }); } }
- Click OK. Then click Saveand type in a name for the action and a description.
- Set your default printer and printer settings to how you want your documents to print (e.g. Double sided, Stapled).
- File -> Action Wizard -> <Your new action>
- Click Next on summary screen. You may tick Don’t show again box if you wish.
- Click Add Files… drop down and choose Add Folders… and select the folder holding the PDFs.
- Click Next and it will start adding the header and printing the files.
Useful Links:
- Base for the JavaScript header is from Steve Wareham’s block post on Adding a Dynamic Stamp to a PDF.
- The code to extract file name is from Adobe JavaScript Reference