You can do it with scripting. I've tried an tested this script in InDesign CS5 on a Mac,
What you need to do is
- Select which text box you want the students' name to go in
- Then under the 'layers' panel, expand the layer it is in, and change the name of the text box by slow double clicking it, and enter "NAME"
- Copy and paste the script below in notepad or textedit
- Edit the first line to
var students = ["First Student", "Second Student"]; etc. (Hopefully this doesn't take longer than if you were not to use the script)
- Save as MakePdfForEachStudent.jsx and save it in
/Applications/Adobe InDesign CS5.5/Scripts/Scripts Panel/Samples/Javascript if you're on Mac (I can't remember where it is on Windows)
- Go to Window > Utilities > Scripts and select MakePdfForEachStudent.jsx
- Follow the process
Hope this helps/works. I may improve this answer later.
// An InDesign CS5 javascript macro for exporting PDFs with different student names.
var students = ["Peter", "Lois", "Meg", "Chris", "Brian"];
var studentsNameTextLayer = "NAME";
// DON'T EDIT BELOW THIS LINE
// Display a "choose folder" dialog box.
if (app.documents.length != 0) {
var myFolder = Folder.selectDialog ("Choose a Folder");
if (myFolder != null) {
myExportPages(myFolder);
}
} else {
alert("Please open a document and try again.");
}
function myExportPages(myFolder)
{
var studentName, myFilePath, myFile;
var myDocument = app.activeDocument;
var myDocumentName = myDocument.name;
var theDialog = app.dialogs.add();
var myPageName = myDocument.pages.item(0).name;
var textBoxName = myDocument.pages.item(0).textFrames.item(whichTextBox);
with (theDialog.dialogColumns.add().dialogRows.add()) {
staticTexts.add({
staticLabel: "Base name:"
});
var myBaseNameField = textEditboxes.add({
editContents : myDocumentName,
minWidth : 160
});
}
var myResult = myDialog.show({
name : "ExportPages"
});
if (myResult == true) {
var myBaseName = myBaseNameField.editContents;
// Remove the dialog box from memory.
theDialog.destroy();
for (var loopCounter = 0; loopCounter < students.length; loopCounter++) {
studentName = students[loopCounter];
studentsNameTextLayer.contents = studentName;
app.pdfExportPreferences.pageRange = myPageName;
var matchColon = new RegExp(":","gi");
myPageName = myPageName.replace(matchColon, "_");
myFilePath = myFolder + "/" + myBaseName + "_" + myPageName + "_" + studentName + ".pdf";
myFile = new File(myFilePath);
myDocument.exportFile(ExportFormat.pdfType, myFile, false);
}
} else {
theDialog.destroy();
}
}