Skip to main content
Inspiring
November 18, 2024
Answered

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

  • November 18, 2024
  • 1 reply
  • 302 views

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 has been closed for replies.
Correct answer CarlosCanto

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
November 18, 2024

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);