Home/ Reference/ Layer Advanced

doc.AddPages(Count) / doc.DeletePages(Range)

Adds and deletes pages. Price tags, business cards, certificates — adding pages as the data grows is standard. Double-check the index before deleting; it isn't undoa

Signature

doc.AddPages(Count) / doc.DeletePages(Range)

Notes

Adds and deletes pages. Price tags, business cards, certificates — adding pages as the data grows is standard. Double-check the index before deleting; it isn't undoable.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
n = 5
doc.AddPages(n)                                     # add 5 pages at once
print("Total pages now: ", doc.Pages.Count)

# delete the last page (1-based)
try:
    doc.DeletePages(doc.Pages.Count)
    print("Last page deleted, remaining: ", doc.Pages.Count)
except Exception as e:
    print("Deleting the page failed: ", e)

About this section: Layer Advanced

Layer Advanced — multi-layer and multi-page workflows.

Other entries in this section