Please Help to create a TextFrame with Autosize properties
I wish to increase the height of the TextFrame
It seems that TextFramePreference.autoSizingType is relevant. What is the point you are having trouble writing well?
var doc = indesign.app.activeDocument;
IDSNadFrame = doc.textFrames.add();
IDSNadFrame.geometricBounds= [5,-600,30,(-600 + widthCol)];
IDSNadFrame.contents=“ആഞ്ഞൂരിൽ പുത്തൻവീട്ടിൽ അമ്മിണി (87) അന്തരിച്ചു. സംസ്കാരം നാളെ 11.30 ന്.”; // place text file
IDSNadFrame.textFramePreferences.autoSizingType = IDSNadFrame.AutoSizingTypeEnum.HEIGHT_ONLY;
IDSNadFrame.resizeToFit();
IDSNadFrame.label = “OBIT:”+ adsID;
This Code shows error:
TypeError: Cannot read properties of undefined (reading ‘HEIGHT_ONLY’)
at flowadsWithPhoto (./assets/js/dak_Obit_Engine.js:470)
at ./assets/js/dak_Obit_Engine.js:376
I am trying to build a UXP plugin automate newspaper page making
I have fixed what seems to be a mistake. Does this work?
// presumably this code is expected to import like this
const indesign = require('indesign');
var doc = indesign.app.activeDocument;
IDSNadFrame = doc.textFrames.add();
IDSNadFrame.geometricBounds= [5,-600,30,(-600 + widthCol)];
IDSNadFrame.contents="ആഞ്ഞൂരിൽ പുത്തൻവീട്ടിൽ അമ്മിണി (87) അന്തരിച്ചു. സംസ്കാരം നാളെ 11.30 ന്."; // place text file
// IDSNadFrame.AutoSizingTypeEnum --> indesign.AutoSizingTypeEnum
// IDSNadFrame.textFramePreferences.autoSizingType = IDSNadFrame.AutoSizingTypeEnum.HEIGHT_ONLY;
IDSNadFrame.textFramePreferences.autoSizingType = indesign.AutoSizingTypeEnum.HEIGHT_ONLY;
// a function that does not exist; the alternative is fit()?
// IDSNadFrame.resizeToFit();
IDSNadFrame.label = "OBIT:"+ adsID;
Bro i already tried this but not working
I will share the full function
async function flowadsWithPhoto(adobject)
{
try
{
var rtfFile = adobject.content;
var MediaPath = adobject.photo;
var adsID = adobject.AdsID;
let IDSNadFrame = null;
let {app,FitOptions } = require(“indesign”);
do
{
// fs.readFile(rtfFile, 'utf8', ( data) => {
// content=data
// })
let grpbox;
try
{
var doc = app.activeDocument;
var photoFrame= doc.textFrames.add();
photoFrame.geometricBounds = [5,-600,9.4,-708];
photoFrame.place(MediaPath);
var photoBounds = photoFrame.geometricBounds;
photoBounds[3]= photoBounds[1] + widthCol;
photoBounds[2]= photoBounds[0] + 68.0315;
photoFrame.geometricBounds = photoBounds;
photoFrame.fit(FitOptions.CONTENT_TO_FRAME);
IDSNadFrame = doc.textFrames.add();
var h = photoBounds[0]+68.0315;
var c=h+60
console.log("h=",h,c)
IDSNadFrame.geometricBounds= [photoFrame.geometricBounds[2]+2, photoFrame.geometricBounds[1], 150, (photoFrame.geometricBounds[1]+widthCol-.2)]
IDSNadFrame.contents = rtfFile
IDSNadFrame.textFramePreferences.autoSizingType = app.AutoSizingTypeEnum.HEIGHT_ONLY;
// [h,-708,c,-708+widthCol];
grpbox = doc.groups.add([photoFrame, IDSNadFrame]);
applyStyleToAdText(IDSNadFrame.parentStory);
IDSNadFrame.label = "OBIT:"+ adsID;
}
catch (e)
{
console.log(e);
}
}
while(false);
}
catch (e)
{
console.log(e);
}
}
Same Error is showing TypeError: Cannot read properties of undefined (reading ‘HEIGHT_ONLY’)
Import AutoSizingTypeEnum.
// let {app,FitOptions } = require("indesign");
let { app, FitOptions, AutoSizingTypeEnum } = require("indesign");
AutoSizingTypeEnum is not under app, but directly under indesign.
// IDSNadFrame.textFramePreferences.autoSizingType = app.AutoSizingTypeEnum.HEIGHT_ONLY;
IDSNadFrame.textFramePreferences.autoSizingType = AutoSizingTypeEnum.HEIGHT_ONLY;
Thank bro its working now