10

I often work on InDesign documents that have sections that are complete and that I want to export to PDF to share with a client but have other sections or pages that are work-in-progress that I would prefer to hide.

My question is, is there a way to mark pages within InDesign as something like "skip-for-export" so that I don't have to manually delete those pages (and have the page numbers be out of order) after I complete my export?

Thanks in advance, Michael

0

2 Answers 2

4

Because of the page number thing, this might not be a perfect solution. But here's what solution I came up using scripting:

Download this sample file and save to your system. It's IDML from CS5, so it should work from CS4+.

You'll notice on pages 3 and 4 that there is a big pink block of text that says DRAFT:

DRAFT screenshot

If you pull up the Script Label panel (Window > Utilities > Script Label), you'll see that it's labeled as "DRAFT_LABEL".

Now, take the following script, copy/paste into a text editor, and save it to your Scripts directory (as a .js or .jsx file, doesn't matter):

try // to get the path of the file that's active when you run the script.
{
    var OpenFilePath = app.documents.item(0).fullName; // Declare a variable representing the open document.
    var OpenFile = app.open(File(OpenFilePath), true, 1332757360); // Create a duplicate to work with. In Adobe's world, "1332757360" means "open a copy".
}
catch (err)
{
    var OpenFile = "error";
    alert("Please save this file before using the script.");
}

var OpenFileLength = OpenFile.pages.length; // Get number of pages of open document and master file.

// These help make the array that stores master markers.
var ArrayCounter = 0;
var FindTheMarkers = new Array();

for (var i=0; i<OpenFileLength; i++) // Loop through every page.
{
    ItemsOnPage = OpenFile.pages.item(i).pageItems.length; // Get the number of items on the page.

    for (var j=0; j<ItemsOnPage; j++) // Loop through every item.
    {
        var ScriptLabel = OpenFile.pages.item(i).pageItems.item(j).label;   

        if (ScriptLabel != "" && ScriptLabel.indexOf("DRAFT_LABEL") == 0) // If the item has a label and it equals what we want it to,
        {
            FindTheMarkers[ArrayCounter] = i; // Put the page number in the array.
            ArrayCounter++; // Advance the counter for next time!
        }
    }
}

var numberToSubtract = 0; // This compensates for screwing up the page counter when you remove a page.

for (i=0; i<FindTheMarkers.length; i++) // Loop through the array and remove pages!
{
    OpenFile.pages.item(FindTheMarkers[i] - numberToSubtract).remove();
    numberToSubtract++;
}

Before you run the script, save the document. Then run it!

I'm a designer who scripts and not the other way around, so this might not be the most elegant code. But what it's doing is scanning through your document for page items that have the "DRAFT_LABEL" tag, then it stores that page number in an array. Once it's done scanning, it removes the appropriate pages.

You're then left with a new file that has the draft pages removed!

3
  • 1
    Complicated. Technical. But works a charm.
    – Dan Hanly
    Commented Aug 28, 2013 at 9:24
  • 1
    +1 - Another approach would be to use the array to specify the page ranges to export, using a stored preset for the other export settings. This would be non-destructive.
    – horatio
    Commented Sep 4, 2013 at 15:00
  • @horatio - Yeah! I was going to mention to the OP that that was a possible solution, but then I didn't because I didn't know for sure; I never tried to work it out. It's a great alternative, especially if you export things the same way all the time. If you want to control the export settings as you usually would, the above solution works better. I also feel obligated to add that this is a non-destructive solution...first thing it does is open a copy so the original is untouched.
    – Brendan
    Commented Sep 4, 2013 at 18:09
2

You can input the desired pages to export to PDF in the Export dialog window...

export

Use hyphens between numbers for a range, and commas to separate individual page numbers.

The above excludes pages 11 through 14, 16, then anything after page 19.

If you mean to export to PDF as if those pages weren't present in the document therefore page numbers reflow to match the export, then no. I don't know of any way to reflow page numbering based on exported pages. You would have to remove pages in the Indesign document first.

2
  • 1
    Hi Scott and thanks for the reply. I'm aware of the ability to export certain pages but it puts the onus on me to keep track as the document grows and shrinks of page numbers which isn't ideal. What I'm really looking for is to make a page itself as draft while I am working on it and be able to publish a PDF of all non-draft pages.
    – Michael
    Commented Aug 26, 2013 at 17:14
  • @Michael I don't thing that's possible.
    – Scott
    Commented Aug 26, 2013 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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