Skip to main content
Inspiring
January 12, 2023
Question

Problem setting units of measurements when creating the doc.

  • January 12, 2023
  • 1 reply
  • 481 views

When setting up document preferences for a new document how do I set the unit of measurement to inches? This is what I have and it does not work.

 

  var doc = app.documents.add{(
    documentPreferences: {
      horizontalMeasurementUnits: MeasurementUnits.INCHES,
      verticalMeasurementUnits: MeasurementUnits.INCHES,
      pageWidth: documentWidth,
      pageHeight: documentHeight,
      documentBleedTopOffset: bleed,
      documentBleedUniformSize: true,
      facingPages: false,
    }

  });
This topic has been closed for replies.

1 reply

Robert at ID-Tasker
Legend
January 12, 2023

Because horizontal(vertical)MeasurementUnits is a property of viewPreferences of the document - not the document itself. 

 

Inspiring
January 12, 2023

So I'm assuming this is it. 

 app.scriptPreferences.measurementUnit = MeasurementUnits.INCHES;

But I just don't know where to put it.

function createDocument(documentWidth, documentHeight, bleed, rectangleWidth, rectangleHeight, textFrameGeometricBounds, pointSize, leadingSize) {
  // Create a new document with the specified width and height and bleed
  var doc = app.documents.add({
    documentPreferences: {
      pageWidth: documentWidth,
      pageHeight: documentHeight,
      documentBleedTopOffset: bleed,
      documentBleedUniformSize: true,
      facingPages: false
    }
  });

 

Loic.Aigon
Legend
January 12, 2023