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

Auto page height size

Participant ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Hi, In InDesign, I want to display each article on a separate page. The page height should automatically adjust vertically based on the length of the text. My heading style is set to "Start in Next Frame."

Screenshot_1.jpg

 

Screenshot_2.jpg

Thank you for your help and rights.

TOPICS
Scripting

Views

555

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jan 11, 2025 Jan 11, 2025

Fun thing to do. Here's a script. To use it, place the cursor in any of the TITLE 1 headings, then run it.

 

The idea is (1) if an article is in one frame, fit the frame to the text, then set the height of the page so that its bottom is 24 points below the text frame. You can change that value. Should probably be the bottom margin.

(2) if an article is in two or more frames, make its first frame insanely tall, to expose the whole article in one frame, then do as in (1) -- resize the frame, then

...

Votes

Translate

Translate
Community Expert ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

It's not possible - page can't resize automatically to the text. 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

If by 'automatic' you mean 'is there an InDesign feature' then no, there isn't. But you can do a script that fits an article into one text frame, then size the page to the text frame. The only thing is that the text frame has no (practical) height limit, but the page does: 5,486 mm -- though a 55 metre tall page will probably do.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

@uniq1

 

What are you trying to achieve? What is your end goal?

 

Votes

Translate

Translate

Report

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
Participant ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

In a text with paragraphs TITLE 1, TITLE 2, TITLE ... under each heading, the heading TITLE 1 and the paragraphs below it must fit on each page until the next heading, i.e. the page size must be changed. After flowing the text through the document, I want the script to place each article on one page.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

@uniq1

 

Why? 

 

What will you do next - with those resized pages? 

 

 

If you work on a PC and have those texts ready - either as a separate TXT / DOC files - or in one large file - or need to get them from a database / whatever the source - and need to import into template(s) - INDD / INDT files, or Master Pages, groups / whatever - and each text into a different template, and then have them exported as a separate pages - PDF / JPEG / PNG / HTML / ePUB / whatever - and then uploaded / emailed / whatever somewhere - I have a perfect tool for you... Isn't free but it will automate the whole process 110%. 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Presumedly, this is not a print document. Technically, it could be printed by shrinking oversized pages to fit the paper size, but the result would basically be the same as reducing the text size to fit the content on a single page. 

If it is meant to be an online document, it sounds as if you want a website, since the HTML pages have not have a static page depth. You could use Dreamweaver, included with your Adobe CC subscription, but there are easier to use systems available for blog-type sites.

 

David Creamer: Community Expert (ACI and ACE 1995-2023)

Votes

Translate

Translate

Report

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
Participant ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

yes, this is not a print document. export pdf 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

How do you expect people to print it or is it read strictly on screen?

 

David Creamer: Community Expert (ACI and ACE 1995-2023)

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

I already have a script that resizes a page to the selected Text Frame 

It's not very good - in my opinion - but it works for me

I'd be happy to share it and maybe it could be finesed and I could learn something too.

Votes

Translate

Translate

Report

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
Participant ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Hi @Eugene Tyson Could you share it? That would be great for me.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Fun thing to do. Here's a script. To use it, place the cursor in any of the TITLE 1 headings, then run it.

 

The idea is (1) if an article is in one frame, fit the frame to the text, then set the height of the page so that its bottom is 24 points below the text frame. You can change that value. Should probably be the bottom margin.

(2) if an article is in two or more frames, make its first frame insanely tall, to expose the whole article in one frame, then do as in (1) -- resize the frame, then resize the page.

 

P.

 

#targetengine fitPagesToArticles

// Place the cursor in any of the heading paragraphs
// the run the script

// resize() requires points
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;

pageWidth = app.activeDocument.documentPreferences.pageWidth;

app.findTextPreferences = null;

try {
  app.findTextPreferences.appliedParagraphStyle = app.selection[0].appliedParagraphStyle;
} catch (_) {
  alert ('Place the cursor in the heading style');
  exit();
}

headings = app.activeDocument.findText();

for (i = 0; i < headings.length; i++) {
  
  frame = headings[i].parentTextFrames[0];
  page = frame.parentPage;

  gb = frame.geometricBounds;
  
  // We consider ranges from one heading to
  // the next. Therefore the last heading
  // ranges to the end of the story
  
  if (i === headings.length-1) {
    // The last heading: the end of the range
    // is the story's last frame
    lastFrame = frame.endTextFrame;
  } else {
    // Not the last heading: the end of the range
    // is up to the next heading
    lastFrame = headings[i+1].parentTextFrames[0];
  }

  if (frame.nextTextFrame != lastFrame) {
    // The article is in more than one text frame.
    // Force the article into one frame
    // by making its first frame very tall
    gb[2] = gb[0]+20000;
    frame.geometricBounds = gb;
  }

  // Set the bottom of the frame to the last baseline
  gb[2] = frame.lines[-1].baseline;
  frame.geometricBounds = gb;
    
  page.resize (CoordinateSpaces.INNER_COORDINATES,
    AnchorPoint.TOP_CENTER_ANCHOR,
    ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
    [pageWidth, gb[2]+24]
  );
}

 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

Just brainstorming... 

 

How about setting Start in Next Frame for those title style(s)? 

 

Then always setting TF insanely high? 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

How about setting Start in Next Frame for those title style(s)? 

 

That's already the case. See the OP's comments. And my script depends on that.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

quote

How about setting Start in Next Frame for those title style(s)? 

 

That's already the case. See the OP's comments. And my script depends on that.


By @Peter Kahrel

 

I don't see any mention of Start in Next Frame anywhere before? 

 

But yes, your solution works on that - I misinterpreted this line a bit. 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

At the very top of the thread.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

quote

At the very top of the thread.


By @Peter Kahrel

 

Right 😞 sorry 😞 now I see it 😞 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

I was thinking about a different approach - probably not as efficient as yours. 

 

Make page insanely high, 

Make TF insanely high. 

Duplicate TF. 

Call Fit Frame To Content - InDesign won't resize TF past the pasteboard area of the current spread so steps 1 and 2 needs to be done. 

Resize page. 

 

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

But if Layout Adjustment would be on - resizing page will automatically resize TF? 

 

Votes

Translate

Translate

Report

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
Participant ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

worked perfectly. there are hundreds of pages and it set every page starting with the title style at once. thank you very much @Peter Kahrel 

Votes

Translate

Translate

Report

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
Guide ,
Jan 12, 2025 Jan 12, 2025

Copy link to clipboard

Copied

"Should probably be the bottom margin." …

 

ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH,
[pageWidth, gb[2]+page.marginPreferences.bottom]
 
(^/)  The Jedi

Votes

Translate

Translate

Report

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
Participant ,
Jan 12, 2025 Jan 12, 2025

Copy link to clipboard

Copied

LATEST

thanks @FRIdNGE yes, it gave more accurate result for me.

Votes

Translate

Translate

Report

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 ,
Jan 11, 2025 Jan 11, 2025

Copy link to clipboard

Copied

@uniq1

 

Any chance you can share a sample file? 

 

Votes

Translate

Translate

Report

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
Participant ,
Jan 12, 2025 Jan 12, 2025

Copy link to clipboard

Copied

Hi @Robert at ID-Tasker I probably won't need to send any files. Peter Kahrel's script is perfect for that purpose.

Votes

Translate

Translate

Report

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