Mobile app version of vmapp.org
Login or Join
Welton168

: Insert a variable on many pages in Adobe InDesign to fill in when printing PDF I have a "Name" field on many worksheet pages which I want automatically filled in with a particular student's

@Welton168

Posted in: #AdobeAcrobat #AdobeIndesign #Pdf #PrintDesign

I have a "Name" field on many worksheet pages which I want automatically filled in with a particular student's name when printing. I know in InDesign I can just create a master page that those worksheet pages use and fill in the name of the student there.

I'd like to have a PDF of the worksheet pages where I just enter the name in the PDF viewer instead of having to do this through InDesign. Is this possible?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Welton168

3 Comments

Sorted by latest first Latest Oldest Best

 

@Angie364

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();
}
}

10% popularity Vote Up Vote Down


 

@BetL875

You could just add a header with the student's name. That would automatically appear on every page. I can't think of a faster way to do this in Acrobat offhand, if you're dealing with lots of pages.

You can set up a header Action (Tools > Action Wizard) ahead of time with everything but the student's name, then add the name for each print run.

10% popularity Vote Up Vote Down


 

@Turnbaugh909

PDFs support fillable form fields, so this is pretty easy to do in Acrobat. But if you want to use InDesign, you typically need to design the form, then use Acrobat to replace the placeholder elements with actual form fields. This page describes the workflow.

Luckily, as mentioned on the same page, Acrobat 9 has an automatic form field detection feature. Adobe has published a set of guidelines to follow to create recognizable form fields. Additionally, here's a PDF of form field recognition best practices.



Edit:

If you need to repeat a field value in multiple places, both LifeCycle and Acrobat allow you to simply duplicate or copy-and-paste the field to different locations/pages. Make sure to set the binding to "Global" in LifeCycle to get the fields to all show the same value. In Acrobat, you just need to make sure all the fields have the same name.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme