Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Remove header and footer from blank left-hand pages

Advocate ,
Aug 17, 2008 Aug 17, 2008
Are there any scripts to automatically remove header and footer on a blank left-hand page for an InDesign CS3 document? I have a book with many chapters and it would be more efficient than removing them by hand.
TOPICS
Scripting
4.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2008 Aug 18, 2008
>it would be more efficient than removing them by hand.

Why not apply the "[None]" master page to these? That's what I do -- I assigned a hotkey to "Assign Master", so it's a mere flick of the fingers.

How about this snip from a page numbering script:

if (app.activeDocument.pages[app.activeDocument.pages.length-1].allPageItems.length == 0)

...


It checks if the last page of the document contains any objects at all. Since items on master pages are not seen in the allPageItems array, a blank page will return '0'.
Note, however, that if the last page contains an
i empty
TextFrame, it will not be considered "empty". If you have that, you'll need to examine this as well.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 18, 2008 Aug 18, 2008
Thanks for your helpful reply. The keyboard shortcut to apply None works great. I'd like to try the Javasript, but am not knowledgeable about Javascript. I assume that something needs to be added to the script you mentioned in order to make it work, because when I tried it I got an error message. Do you have any tips on how to make the script work? (I did a search in the scripting forum and couldn't find that particular script.)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 18, 2008 Aug 18, 2008
It's a one liner from a much longer script that does quite something else -- this is merely a side effect, a quick way to get a page range (i.e., I need the range "251-256" to appear on my first page, excluding an optional blank last one)
  • .

    Perhaps I could write a full script, but for that I need a bit more information. Is your document an InDesign Book, with each chapter in a separate document? If so, any empty frame on a last leftmost page can safely be deleted. If your book is in a *single* InDesign document, this line can only be used if a left hand page has *no objects at all* -- not even an empty frame. That's the easy case -- in English "if there are no objects on the page, apply the "[None]" master. If there *is* a frame, however, it cannot be removed right away, even if it seems empty. That's because in that case you probably have inserted a page break somewhere on the previous page, and if the frame is deleted, tht page break will push off the text on the *next* page (the right hand). It also depends on what kind of page break -- as a character or as a paragraph Keep Option; Next Page, Next Frame, Next Odd Page, Next Column. Way too complicated to script right off the bat.

    All in all, applying that empty master maually is much easier :-)

  • Sure, I know how to use the Next Page Number trick. However, I also need the range in my XML output, and the Page Number markers do not play nice when written out in ASCII.
  • Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Community Expert ,
    Aug 18, 2008 Aug 18, 2008
    jong,

    >I need the range "251-256" to appear on my first page, excluding an optional blank last one

    Why not use a variable for the last page?

    Peter
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Community Expert ,
    Aug 18, 2008 Aug 18, 2008
    Peter,

    Does that comply with my added footnote? (I don't think so -- I think I tested, and found variables are not exported written out in XML. Converting them to plain text is not an option, as they may change; and converting them, exporting, then undo-ing is a similar work-around as I have now.)

    But I know for sure the Last Page variable
    i does
    count the optional blank page at the end -- the one ID adds for a Book document to ensure the next document starts at the right hand page. That should be excluded in my page range.
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Community Expert ,
    Aug 18, 2008 Aug 18, 2008
    >Does that comply with my added footnote?

    If the last page of a document is blank, you can create a section at the last page so that the page range excludes that last page (you also need to set the variable's scope to section).

    It is indeed the case that variables can't be tagged to be included in XML. But the XML structure is simple and I don't bother with tags -- when I need to create XML for a document using things like first and last page, I usually script that.

    So in fact we both rely on a script to get what we want but do it in different ways.

    Peter
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Advocate ,
    Aug 18, 2008 Aug 18, 2008
    Hi Jong,
    To answer your question, yes, I have multiple documents in an InDesign CS3 book, with each chapter in a separate document. There are no page breaks. It would be great to automate applying the None master with a script, but I don't want to impose on your kindness if it is a time-consuming task.
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    New Here ,
    Feb 18, 2009 Feb 18, 2009
    I have inserted a header on both the pages of master page i.e right and left. I wish to remove the right page header on page one. It may apear on page 3,5 etc. and so on but not on page 1. How to do that. Please explain
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines
    Community Expert ,
    Feb 18, 2009 Feb 18, 2009
    LATEST
    >[...] [A master page header] may apear on page 3,5 etc. and so on but not on page 1.

    Why not apply the "[None]" master page to these? That's what I do -- I assigned a hotkey to "Assign Master", so it's a mere flick of the fingers.
    Translate
    Report
    Community guidelines
    Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
    community guidelines