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
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.
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?
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;
}
}
Copy link to clipboard
Copied
Moved to own thread
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.
Copy link to clipboard
Copied
Hi @ars999:
One additional idea:
~Barb
Copy link to clipboard
Copied
Beautifully illustrated!
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.
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".