: Hiding incomplete pages in an InDesign document 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
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
More posts by @Cofer715
2 Comments
Sorted by latest first Latest Oldest Best
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:
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!
You can input the desired pages to export to PDF in the Export dialog window...
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.