Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

How to create a document with a default unit of mm by jsx?

Explorer ,
Mar 27, 2024 Mar 27, 2024

jsx guide:

app.documents.add([documentColorSpace] [, width] [, height] [, numArtBoards]
    [, artboardLayout] [, artboardSpacing] [, artboardRowsOrCols]
)

no param to set the unit

or can I set the unit after the document created? anyone advice?

TOPICS
Bug , Feature request , Import and export , Print and publish , Scripting , SDK , Tools
227
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Mar 27, 2024 Mar 27, 2024

Hi @LoveYou阿逗逼6666, you can make a document preset:

var myDocPreset = new DocumentPreset;
myDocPreset.artboardLayout = DocumentArtboardLayout.GridByRow;
myDocPreset.artboardRowsOrCols = 1;
myDocPreset.artboardSpacing = 20;
myDocPreset.colorMode = DocumentColorSpace.RGB;
myDocPreset.documentBleedLink = true;
myDocPreset.documentBleedOffset = [0, 0, 0, 0];
myDocPreset.height = 5000;
myDocPreset.numArtboards = 1;
myDocPreset.previewMode = DocumentPreviewMode.DefaultPreview;
myDocPreset.rasterResolution = DocumentRasterResolution.ScreenResolution;
myDocPreset.title = 'Test';
myDocPreset.transparencyGrid = DocumentTransparencyGrid.TransparencyGridNone;
myDocPreset.units = RulerUnits.Millimeters;
myDocPreset.width = 5000;

var newDoc = app.documents.addDocument("Basic RGB", myDocPreset);

 

Just an example, but I've set the RulerUnits to millimeters to show you.

- Mark 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2024 Mar 27, 2024
LATEST

Also can do this way:

var myDocPreset = app.getPresetSettings('Web');
myDocPreset.width = 960;
myDocPreset.height = 768;
myDocPreset.units = RulerUnits.Millimeters;

var newDoc = app.documents.addDocument(DocumentPresetType.Web, myDocPreset);

 - Mark

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines