How to recognize the first and the last pages of the document

Question

Is it possible to recognize only the first and the last page without knowing the total page count in advance and without recognizing all of of the pages?

Answer

To do this, please use MoveById and DeleteById methods of Pages Object. For example:

// C#
var pages = Document.Pages;
int p_count = pages.Count;
if (p_count > 2)
{
pages.MoveById(pages.Item(p_count-1).Id, pages.Item(1).Id)
for (int i = p_count; i>2; i--)
{
pages.DeleteById(i)
}
}

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request