4

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?

4

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.

  • Sorry, took a while to respond, but this is what we just now ended up doing. Thanks for the tip! – at. Jun 22 '12 at 17:18
5

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();
    }
}
  • 4
    Adam, welcome indeed to GD.SE. You are officially appointed InDesign Script Guru. :) (Seriously, you're immediately a great asset to our community, so I do hope you'll visit often!) – Alan Gilbertson Apr 13 '12 at 5:48
  • Thanks Alan, will sure do. Scripting with Creative Suite is my specialist area – Adam Elsodaney Apr 16 '12 at 22:59
  • 1
    And, clearly, you have that amazing scripter trait of being super-helpful to passing strangers, stray animals, and birds that have fallen out of their nests. It must be something in the code... :) – Alan Gilbertson Apr 16 '12 at 23:11
3

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.

  • I don't think this is what I need. If I only had 1 Name field, this would work. But I have MANY Name fields that all need to be filled in at once. – at. Apr 10 '12 at 16:39
-1

Great work Lese majeste.

If you have many name fields and they all need the same value, the latest acrobat has a viewer panel that lists the form fields recognized, and it will give them a number with a dot for every field that has the same recognition. You have to get them all together, and rename each one to the same name one at a time, which really doesn't help much. However, if you can keep all the docs with the same student together in a row, you can use a javascript to alter the field names for a number of pages by matching the fieldname to a string, then copy the field setup data (all the programming of the field) to a new field, giving it the same name as the first name field, including the location on the page, and then delete the old field in order to remove it from the page processing. You'll have to include a variable for which pages to read through, I'd suggest taking a this.pagenumber + pagestoread approach so you can just select different sets of pages. If you know your number of students, you can run the script for each student's set of pages. I'm not a programmer so the language isn't in my toolbox, but the design pieces are. I'm a process designer. Basically I use the basic test structures to build processes, others translate that into programming. Occaisionally I look up examples of each piece, then make changes and tie it together to get working scripts. According to the API library, you can access the fields, create, copy and delete them. You just have to match the data types between the pieces of data that define the field. Check adobe.com forums for the api and examples of the pieces you want to play with, then use google to find examples of the rest, put them together correctly and you'll be able to create a popup box where you fill in each name, which then gets filled in on each set of pages as you require. If they are all the same set of pages, you can play with that too. I've built scripts that fill a set of data in fields using popups, then saves a separate document with the name as part of it, and then resets for the next name until I tell it to cancel. Then even saving the document doesn't break the programming, and I have each set saved in a folder. I can combine them or leave them that way with a single operation built into acrobat.

  • Welcome to Graphic Design SE. Can you please edit your answer to have some structure (e.g., paragraphs) and be less stream of thought? As it stands, it is very exhausting to read. – Wrzlprmft Mar 17 '18 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.