Skip to main content
Known Participant
March 2, 2020
Answered

Is there a way to tell which page number the textframe exists in?

  • March 2, 2020
  • 3 replies
  • 566 views

I am trying to find out whether a particular text exists and perfectly fits in the text frame and when the text flows to the next text frame, then upon calculating the coordinates(baseline) of the next frame iam increasing the size of the existing frame and trying to fit the text but when the text frame is in the next page then the baseline it's giving me a negative value so I would like to know if there is any way I could understand that the next text frame is in next page so as to avoid negative value while calculating.

This topic has been closed for replies.
Correct answer Manan Joshi

Try the following

txtFrameObj.parentPage.name

 

Where txtFrameObj is the textframe object which you want to check

 

-Manan

3 replies

Community Expert
March 2, 2020

Hi SundeepPidugugu,

if you are looking for the text frames ( or text paths ) of found text ( e.g. using methods findText() or findGrep() or other means )  see into the parentTextFrames array of the text.

 

In case all the text is in overset the array is of length 1, but if you are looking what's inside that array you'll see that parentTextFrames[0] will return undefined.

 

So be careful when asking for parentPage of a parentTextFrame of a text object.

FWIW: Even if the text is visible in the layout parentPage could return null if the text container, text frame or text path, is on the pasteboard.

 

Regards,
Uwe Laubender

( ACP )

Jongware
Community Expert
Community Expert
March 2, 2020

That's a roundabout way to check it. Just test nextTextFrame :

 

txtFrameObj = app.selection[0];
if (txtFrameObj.nextTextFrame && txtFrameObj.parentPage == txtFrameObj.nextTextFrame.parentPage)
	alert ('same page');

 

Manan JoshiCommunity ExpertCorrect answer
Community Expert
March 2, 2020

Try the following

txtFrameObj.parentPage.name

 

Where txtFrameObj is the textframe object which you want to check

 

-Manan

-Manan