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

How to detect disconnected pages

New Here ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Hi all,

 

I want to delete all empty pages of the document. When there are empty disconnected pages added I can't detect them in order to delete. Is there a way to do that?

 

Thanks in advance

Views

411

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 ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

If you view your text symbols (View > Text Symbols), you can look for end-of-flow symbols on each page. A page that is not the last that has an end-of-flow symbol is disconnected. If I get some time today, I will post some code to do it programmatically.

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
New Here ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

Hi. I think this is a good way to detect the disconnected pages. Can you provide some information how can it be implemented programmatically?

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 ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

I would do something like this:

#target framemaker

main ();

function main () {

    var doc, mainFlow, page, textFrame;

    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
        // Get the document's main flow.
        mainFlow = doc.MainFlowInDoc;
        // Loop through each page in the document.
        page = doc.FirstBodyPageInDoc;
        while (page.ObjectValid () === 1) {
            // Get the A flow text frame on the page.
            textFrame = getTextFrame (page, "A");
            if (textFrame) {
                // See if the text frame's flow is the main flow.
                if (textFrame.Flow.id !== mainFlow.id) {
                    // If not, you have a disconnected pageg.
                    $.writeln ("Disconnected page: " + page.PageNumString);
                }
            }
            page = page.PageNext;
        }
    }
}

function getTextFrame (page, flow) {
    
    var frame, graphic;
    
    frame = page.PageFrame;
    graphic = frame.FirstGraphicInFrame;
    while (graphic.ObjectValid () === 1) {
        if (graphic.constructor.name === "TextFrame") {
            if (graphic.Flow.Name === flow) {
                return graphic;
            }
        }
        graphic = graphic.NextGraphicInFrame;
    }
}

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 ,
Aug 01, 2023 Aug 01, 2023

Copy link to clipboard

Copied

LATEST

Moved to own 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 ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Another way to do it manually: Click in the document's main flow and Edit > Select All. Edit > Cut the content to the clipboard. Delete all pages from the document except the first. Put your cursor in the first page and Edit > Paste.

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 ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Hi @ars999:

 

One additional idea: 

  1. Click inside the text
  2. Edit > Select all in Flow
  3. Zoom out to 25%
  4. The pages that don't have text selected are the disconnected pages. If there is content on those pages, you can cut/paste it back into the main flow. Once that is completed, repeat the process and then delete the disconnected pages. 

 

~Barb 
disconnected pages.png

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 ,
Aug 05, 2021 Aug 05, 2021

Copy link to clipboard

Copied

Beautifully illustrated!

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 ,
Aug 09, 2021 Aug 09, 2021

Copy link to clipboard

Copied

re: I want to delete all empty pages of the document.

Keep in mind that not all empty pages are disconnected pages.

In a duplex (double-sided) document, any Paragraph Format (or override) that starts at Top of [L|R] Page can result in a blank page being left behind. Separate Chapter files can result in a blank at end of prior. There is no way to delete these meta-blank pages other than using single sided layout, or implementing some TPILB (ThisPageIntentionallyLeftBlank) scheme, so that no meta-blanks are actually blank.

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 ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Can you use the "Delete Empty Pages" configuration?

Format > Page Layout. In the Pagination dialog box, under "Before Saving and Printing", select "Delete Empty Pages".

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