Search code examples
javascriptadobe-indesign

InDesign resize Text Frame


I want to resize entire indesign document width and height here is my code its give error

Error Number:11265 Error string: This value would cause one or more object to leave the paste board

please help me to fix, Thank you

var NEW_HEIGHT = '25 cm';  
var NEW_WIDTH = '18 cm';  

// MULTIPLE RESIZE() IN ONE STEP  
// =============================  
app.activeDocument.textFrames.everyItem().resize(  

    // Target bounding box(es) -- Use OUTER_STROKE_BOUNDS if needed  
    // ---  
    [CoordinateSpaces.INNER_COORDINATES, BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS],  

    // Reference point -- Here resize is performed relative to the top edge  
    // ---  
    AnchorPoint.TOP_CENTER_ANCHOR,  

    // Absolute replacement  
    // ---  
    ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, 

    // [width, height] in points  
    // ---  
    [UnitValue(NEW_WIDTH).as('pt'), UnitValue(NEW_HEIGHT).as('pt')] 
    ); 

Solution

  • You need to increase the size of the pasteboard before you begin resizing.

    To do this add the following line of code before your resize step:

    app.activeDocument.pasteboardPreferences.pasteboardMargins = [ '1000pt', '1000pt'];
    

    Note: You may need to increase the x and y values (i.e. 1000pt) depending on the size of your document(s).

    Further info regarding the PasteboardPreference class can be found here.