Skip navigation
Currently Being Moderated

Script that rescale a document by 50% to match both iPad resolutions

Apr 4, 2012 12:49 AM

Hi guys,

my first issue of Appliness (www.appliness.com) is a 768x1024 folio. For the next issue, I'll output two renditions: a 1536x2048 and a 768x1024.

I'm not an InDesign expert, so I've tried to find the best workflow with my friend Stephane Baril. The best way I've found is to start by creating my folio with high-resolution pages (1536x2048), and at the very end, scale down everything by 50% to get the iPad1/iPad2 rendition. Manually, it's not easy to scale down everything. So I ended up writing a small JavaScript that:

  • gets the orientation of the document (landscape and portrait)
  • unlock all the layers of the document
  • loop on all the pages
  • free the items from the master pages
  • create a blank rectangle that fits the dimension of the page (to get a well defined center of the page while scaling)
  • groups all the elements of the page
  • scale everything by 50%
  • resize the pages to 768×1024
  • changes the properties of the document to set the new dimensions and the correct orientation

 

DISCALIMER: It works well for my magazine. As I'm not an InDesign expert, I cannot guarantee that it will work with your pages, but it's worth a try... there's no risk. It will produce 768x1024 documents but you will lose your layers. So consider it just as an 'output', or an 'export', a 'flat copy' to quickly get a 768x1024 rendition from your 2536:2048 work.

 

I've posted the code of my JavaScript here: http://appliness.com/automatic-rescale-with-indesign/

I'll try to attach the script in this post. As it's code, I don't know if it will be accepted.

 

I hope it helps.

Attachments:
 
Replies
  • Bob Bringhurst
    4,644 posts
    May 29, 2007
    Currently Being Moderated
    Apr 4, 2012 7:03 AM   in reply to MichaelChaize

    Thanks for sharing this script. It's especially useful if you want to create different sets of source files, although I find that creating 1024x768 source documents and adding them to 2048x1536 folios works fine for me.

     

    The DPS Cookbooks is a good place for you to post your script. Mark just recently posted a scrollable frames video. Please feel free to add a recipe:

     

    http://cookbooks.adobe.com/digital_publishing_suite

     
    |
    Mark as:
  • Bob Bringhurst
    4,644 posts
    May 29, 2007
    Currently Being Moderated
    Apr 4, 2012 7:35 AM   in reply to MichaelChaize

    Thanks! Here's the link where you can download Michael's script:

     

    http://cookbooks.adobe.com/post_Script_to_scale_down_your_pages__Usefu l_to_target-19685.html

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 5, 2012 6:17 AM   in reply to MichaelChaize

    @Michael – thank you for the script.

     

    However, my biggest concern using it is that it will not deal with the document baseline grid settings.
    If texts will use this feature one will create overset text frames and/or wrong leading and wrong baseline positions.

     

    To deal with that might mean you have also to take  into account margin properties…

     

    Another concern is: it does not set the app transform preferences. So, if someone has set the property "whenScaling" to "WhenScalingOptions.APPLY_TO_CONTENT" the script might fail. We can change that to "WhenScalingOptions.ADJUST_SCALING_PERCENTAGE":

     

    app.transformPreferences.whenScaling = WhenScalingOptions.ADJUST_SCALING_PERCENTAGE;
    

     

    Furthermore it does not deal with locked page items. Unlocking a layer does not mean unlocking all page items applied to that layer.

    So we need an additional step (see one possible solution):

     

    //UNLOCK LAYERS
    var myLayers = myDocument.layers.itemByRange(0, myDocument.layers.length-1);
     
    myLayers.locked = false;
     
    //ADDITIONALLY unlock all page items with a script menu action (ID = 11396) in one go
    //(works on all spreads even master spreads, if all layers are unlocked)
     
    try{app.scriptMenuActions.itemByID(11396).invoke()}catch(e){};
     
    //A formerly locked object on the actual spread could be selected now.
    //So we get rid of that selection to clean things up:
     
    app.select(null);
    


    Oh. And if I'm at it (just a minor one):

    you could clean up the helper rectangle, if you assign it to a variable and remove the object later on:

     

    var helperRectangle = myPages.item(i).rectangles.add({
        //put your properties here
        });
     
    //... do grouping, scaling etc.
     
    //Now the helper rectangele is not needed any more:
    helperRectangle.remove();
    

     

    Uwe

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points