Skip to main content
Inspiring
Nov 18, 2024 8:43 AM UTC
Answered

How do I create a new document with the same dimensions as the original document?

If you make a new document with dimensions as in the original document, then the dimensions of the artboard do not match at all in the new document, how can this be handled?

 

    var sourceDoc = app.activeDocument;
    var newDoc = app.documents.add(DocumentColorSpace.CMYK);
    newDoc.artboards[0].artboardRect = sourceDoc.artboards[0].artboardRect;
This topic is closed to new replies. Start a new post to keep the conversation going.
CarlosCanto
CarlosCantoCorrect answer
Community Expert
Nov 18, 2024 6:56 PM UTC

instead of copying the Artboard dimensions, try using a document Preset where you can supply some of the properties before creating the document

 

var sourceDoc = app.activeDocument;

var docPreset = new DocumentPreset;
docPreset.width = sourceDoc.width;
docPreset.height = sourceDoc.height;
docPreset.units = RulerUnits.Points;
docPreset.colorMode = DocumentColorSpace.RGB;

var newDoc = app.documents.addDocument("Web", docPreset);

1 reply

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
Nov 18, 2024 6:56 PM UTC

instead of copying the Artboard dimensions, try using a document Preset where you can supply some of the properties before creating the document

 

var sourceDoc = app.activeDocument;

var docPreset = new DocumentPreset;
docPreset.width = sourceDoc.width;
docPreset.height = sourceDoc.height;
docPreset.units = RulerUnits.Points;
docPreset.colorMode = DocumentColorSpace.RGB;

var newDoc = app.documents.addDocument("Web", docPreset);
Translate