在 InDesign 文档中隐藏不完整的页面

平面设计 土坯设计
2022-01-24 16:48:47

我经常处理包含完整部分的 InDesign 文档,并且我希望将其导出为 PDF 以与客户共享,但我希望隐藏其他正在进行的部分或页面。

我的问题是,有没有办法将 InDesign 中的页面标记为“跳过导出”之类的东西,这样我就不必在完成后手动删除这些页面(并且页码乱序)出口?

在此先感谢,迈克尔

2个回答

由于页码的问题,这可能不是一个完美的解决方案。但这是我使用脚本提出的解决方案:

下载此示例文件并保存到您的系统中。它是来自 CS5 的 IDML,因此它应该适用于 CS4+。

您会在第 3 页和第 4 页注意到有一大块粉红色的文本,上面写着 DRAFT:

草稿截图

如果您拉起Script Label面板 ( Window> Utilities> Script Label),您会看到它被标记为“DRAFT_LABEL”。

现在,将以下脚本复制/粘贴到文本编辑器中,然后将其保存到您的 Scripts 目录(作为 .js 或 .jsx 文件,没关系):

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++;
}

在运行脚本之前,请保存文档然后运行它!

我是一个编写脚本的设计师,而不是相反,所以这可能不是最优雅的代码。但它所做的是在您的文档中扫描具有“DRAFT_LABEL”标签的页面项目,然后将该页码存储在一个数组中。完成扫描后,它会删除相应的页面。

然后,您会得到一个已删除草稿页的新文件!

您可以在“导出”对话框窗口中输入要导出为 PDF 的所需页面...

出口

在数字之间使用连字符表示范围,使用逗号分隔各个页码。

以上不包括第 11 页至第 14 页、第 16 页,以及第 19 页之后的任何内容。

如果您的意思是导出为 PDF,就好像文档中不存在这些页面一样,因此页码会重排以匹配导出,那么没有. 我不知道有什么方法可以根据导出的页面重排页面编号。您必须先删除 Indesign 文档中的页面。