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

Insert Blank Page - every other page with Autoflow

Community Beginner ,
Sep 28, 2021 Sep 28, 2021

Hoping someone can help... I saw another post where a script can be used to insert a blank page every other page, however when I tried it, a single blank page was only added to the bottom of my document. I have a hunch its because I am using Autoflow on my content but am not sure... 

Is there a way of overcoming this using scripting I wonder?

Alternatively what I am ultimatly trying to achieve is that my printing would occur on odd pages only while being ran through a batch job on a server. (Not locally using the print dialogue box where I can see the option for this)

Any help greatly appreciated!

TOPICS
How to , Print , 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 ,
Sep 28, 2021 Sep 28, 2021

Does this not work? 

var doc = app.activeDocument;
var pages = doc.pages.everyItem().getElements();
for (var i = 0; i < pages.length; i+=2) {
    doc.pages.add(LocationOptions.AFTER, pages[i], {appliedMaster : null});
}
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 Beginner ,
Sep 28, 2021 Sep 28, 2021

Unfortunatly not ... do you think it is because I have Autoflow on my content item? The finished document could be hundreds of pages long and its all contained in content items with Autoflow... Thanks very much for the help....

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 ,
Sep 28, 2021 Sep 28, 2021

Autoflow doesn't play a role. In Brian's script, remove 

.everyItem().getElements()

from the second line and it works as expected. The reason is that the Pages object must be rebuilt every time you add one, so you can't work with the collection converted to an array.

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 Beginner ,
Sep 28, 2021 Sep 28, 2021

Thanks very much, It's still producing multiple pages with just a single blank page at the end..  could it be because my content is contained in Table Structures that have settings for keeping rows together and widows and orphans do you think? etc.... appreciate the help...

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 Beginner ,
Sep 29, 2021 Sep 29, 2021

Ive just used the script with a plain block of text and am getting the same results (blank page at the bottom) so hopefully Its because of my document set up ....? Ive provided a few screenshots if its obvious where im going wrong? Thanks again...

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 ,
Sep 29, 2021 Sep 29, 2021

Please upload an idml document with the setup. Tables should not affect anything either.

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 Beginner ,
Sep 29, 2021 Sep 29, 2021

Thanks very much I have tried it also on just a plain text box and cant get it working so im sure its something im doing wrong in my set up... Does it matter that I am using xPresso along with InDesign? I have attached the artifacts below - thanks alot! it wont allow me to upload an .xsd but its empty anyway just to demonstrate...  Thanks again!

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 ,
Sep 29, 2021 Sep 29, 2021

Worked for me using Peter's suggestion: 

var doc = app.activeDocument;
var pages = doc.pages;
for (var i = 0; i < pages.length; i+=2) {
    doc.pages.add(LocationOptions.AFTER, pages[i], {appliedMaster : null});
}

See screenshot attached.

 

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 Beginner ,
Sep 29, 2021 Sep 29, 2021

Thank you for your time, I wonder what the output appears like using a preview? Sorry for the questions.. I'm missing something somewhere.. would be great to see a sample idml if possible but don't want to ask too much..  appreciate the help!

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 ,
Sep 29, 2021 Sep 29, 2021

I just added a couple pages to your doc. The preview is the pages panel : Windows >> Pages

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 Beginner ,
Sep 29, 2021 Sep 29, 2021

ah ok thank you again, so did you then manually add text to pages 3 and 5?

I am able to get the script to insert the page but when I use publish or preview to view the output the pages appears at the bottom of the entire document. What I would like is that it appears every second page. My Text is 'variable' coming from a datasource so that first page with the 'Ipsom Lorum....' should Autoflow onto page 3, 5, 7 etc with a blank page between each page with text... If you have manually added a blank page, then a page with text then a blank page then a page with text then I guess its not exactly what I was hoping for ? Could that be the case in your screenshot? 

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 ,
Sep 30, 2021 Sep 30, 2021

Your document (insert page test lorum ipsom.indd) contains just one page with an overset text frame on it. The script that Brian posted (and my variant of it) assume that the document is paginated. So what you want is a script with two functions: (1) add pages until there's no more overset text and (2) insert a blank page after every second page. Or, better yet, add pages until there is nolonger any overset text, but place the text frames only on rectos.

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 ,
Sep 30, 2021 Sep 30, 2021

You need to run your plugin to paginate the pages before running the script. Yes I added pages manually. 

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 Beginner ,
Sep 30, 2021 Sep 30, 2021

Thanks very much, when you say run your plug in before running the script... what plug in would that be? I just use publish really through xpresso to generate amd paginated at the same time... Appreciate the help... !

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 Beginner ,
Sep 30, 2021 Sep 30, 2021

Thanks very much this does seem to be more like the script I would need alright... I wonder is there a repository of InDesign references or objects or commands that I could refer to somewhere ie when you say recto or overset text... if I had that maybe I could better make this type of script as it doesn't seem to be out there currently... thanks again for your time and feedback its much appreciated.

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 ,
Oct 01, 2021 Oct 01, 2021
LATEST

'Overset text' is the text that doesn't fit in a frame, and dangles in limbo. It is exposed when you enlarge the frame or thread the frame to another one. 'Recto' is a right-hand page, that's a general term, not specifically InDesign.

There's no repository as such. You can find a lot on Google. A reference book on InDesign with a good index is useful.

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