Batch convert Indesign page size script

Learn / Forums / InDesign User Groups / Batch convert Indesign page size script

Viewing 13 reply threads
  • Author
    Posts
    • #117162
      Tim Coleman
      Member

      Hi, does anyone know how to batch convert multiple InDesign document page sizes? I have thousands of documents that are 51 x 60mm and they need to be converted to 51 x 48mm. I realise it can be done by opening each document and either applying liquid layout or changing the document size or using the page tool but with so may documents I need a way of automating the task. I’ve also tried combining all the documents into a Book file but this doesn’t change the document size for all documents in the book even though they all share the same name Master page. I’m pretty sure it needs to be script. I’m working on a Mac using Adobe CC.
      I’ve sent an email to Peter at [email protected] but not heard back.

    • #117163

      Hello Tim,

      This could certainly be handled by a script but before you start down that path, let’s figure out if this can indeed be done by utilizing InDesign’s book feature (I think you might have had the right idea).

      Open the book that you added all of your documents to.

      Open the document that is being used as your style source. (this will be the document listed in your book with a small icon to left of the name).

      go to the Master page and adjust the page size to your liking and save the document.

      Go to the flyout menu in the book panel and choose “Synchronize Options”.

      Make sure that the “Master Pages” check box is ticked (This is NOT ticked on by default)

      Now synchronize your book by going to the book panel’s flyout menu and choosing “Synchronize Book”.

      If all of your master pages have the same name across all of the documents then that should do it! Spot check a few of your documents to be sure that the change took effect and be sure to let us know if this worked for you.

      Thanks,

      Jeremy

    • #117164
      Tim Coleman
      Member

      Hi Jeremy, thanks for the quick reply. I tried it again abut this didn’t change the page size in the other documents in the book. If you’re sure this works then I can do a restart and try again, but I have tried this several times already. (Mind you I was sure it worked on an early test. This is driving me a bit crazy)

      I’m playing around with a script which is starting to work:

      tell document preferences of front document
      set page height to “48mm”
      set page width to “51”
      set document bleed top offset to “0”
      set document bleed uniform size to true
      end tell

    • #117165

      If you are using AppleScript then make a copy of your files into a new folder (just in case this doesn’t work as expected) and try this “quick and dirty” script that I just wrote up:

      (* select all of the files that you would like to convert *)
      tell application “Finder” to set theFiles to selection

      repeat with currentFile in theFiles

      (* opens each file in the default application – this will be whatever the latest version of InDesign is on your machine *)
      tell application “Finder” to open currentFile

      tell application “Adobe InDesign CC 2018”
      (* repeat/try combo checks to see if the front document is open. As soon as the script can set the active document as a variable this repeat will be exited *)
      repeat
      try
      set myDoc to active document
      exit repeat
      on error
      delay 1
      end try
      end repeat

      (* your preferences here *)
      tell document preferences of myDoc
      set page height to “48mm”
      set page width to “51”
      set document bleed top offset to “0”
      set document bleed uniform size to true
      end tell

      (* Save the document in place and close it *)
      tell myDoc
      save
      close
      end tell
      end tell

      end repeat

    • #117167
      Tim Coleman
      Member

      OMG OMG OMG!
      AWESOME!!! Thanks heaps Jeremy :)))

      This script changes the page size as required. What I need it to do now is move all objects on the page up on the Y Axis: -6mm
      (This is to compensate for the the new page size cropping the top and bottom of the document).

      I basically need the script to:
      Open all InDesign documents
      Resize document page size
      Move objects -6mm
      Save document
      close document

    • #117168
      Tim Coleman
      Member

      Alternatively if the script could set the PAGE size (using the bottom middle reference point) instead of the document size we wouldn’t need to move any of the objects on the page.

      I’ve gotta say how impressed I am with your quick and dirty script!

    • #117169

      Are all of these documents a single page?

    • #117170
      Tim Coleman
      Member

      Yes, each document is a single page. Each page is the same size and all the objects on the page sit on the bottom page margin.

    • #117171
      Tim Coleman
      Member

      I’ve got to go soon Jeremy so if I don’t respond, thanks for all your help. I’ve just found a “Select Objects” script in InDesign scripts that may help. Have a great weekend!

    • #117173

      I’ll take a look at it in the morning. If you want to increase the odds of me figuring something out then send one of the indesign docs to [email protected]

      Have a good weekend!

    • #117181

      Here it is!

      This script will open InDesign documents that you have selected in Finder, open them, resize pages, save and close documents.

      Features:
      • Dynamic movement of page objects to keep them aligned to the bottom margin.
      • Works with unlimited number of documents.
      • Works on unlimited number of pages per document.

      Warning:
      This script saves the document in place so all of the selected InDesign documents will be overwritten. I recommend creating a copy of your files prior to running the script.

      ————————————————————–
      ———————–BEGIN SCRIPT———————–
      ————————————————————–

      (* set new dimensions for the pages that you will be batching *)
      set newDocHeight to 48
      set newDocWidth to 51

      (* select all of the files that you would like to convert *)
      tell application “Finder” to set theFiles to selection

      repeat with currentFile in theFiles

      (* opens each file in the default application – this will be whatever the latest version of InDesign is on your machine *)
      tell application “Finder” to open currentFile

      tell application “Adobe InDesign CC 2018”
      (* repeat/try combo checks to see if the front document is open. As soon as the script can set the active document as a variable this repeat will be exited *)
      repeat
      try
      set myDoc to active document
      exit repeat
      on error
      delay 1
      end try
      end repeat

      tell document preferences of myDoc
      (* get current page dimensions *)
      set startHeight to page height
      set startWidth to page width
      (* set page dimensions to our new dimensions *)
      set page height to ((newDocHeight & “mm”) as string)
      set page width to ((newDocWidth & “mm”) as string)
      end tell

      (* find the distance that the page items should be moved using the “roundThis” handler *)
      set xMovement to my roundThis(((newDocWidth – startWidth) / 2), 4)
      set yMovement to my roundThis(((newDocHeight – startHeight) / 2), 4)

      set docPages to every page of myDoc

      (* repeat through all pages in the document and move page items according to the math above *)
      repeat with thisPage in docPages
      move thisPage’s page items by {xMovement, yMovement}
      end repeat –Doc pages

      (* Save the document in place and close it *)
      tell myDoc
      save
      close
      end tell –myDoc
      end tell –InDesign

      end repeat –Repeat with currentFile in theFiles

      (* handler for rounding decimal places *)
      on roundThis(n, numDecimals)
      set x to 10 ^ numDecimals
      tell n * x to return (it div 0.5 – it div 1) / x
      end roundThis

    • #117198
      Tim Coleman
      Member

      Jeremy you are a VERY smart person. THANK YOU!

      I’s absolutely BRILLIANT!

      :))))

    • #117260

      Hey Tim,

      I am so glad to have helped! Hopefully others will find this script useful as well!

    • #14323964
      Neil Carter
      Member

      Guys, you need to check this out https://www.maycouk.com/homenew
      It’s been a lifesaver where I work, resizes, saves, multiple Indesign docs, exports, pdf, png or jpg to wherever you want, it’ll drop in translations too.
      Worth every penny. Tell Richard Maycock where you heard this from.

Viewing 13 reply threads
  • You must be logged in to reply to this topic.
>