I am running the code below to attempt to remove a page I created and added a legend to. It gets no error. I created a test file that only had one page and a legend. If I step in the debugger, I see the scroll bar change as if there is no second page and then change back. the second page is now a blank page and does not have the legend content. The bookmark is gone. If I attempt to delete the pag in the UI, I get an error indicating the page is in use. If I save and close thfile, then reopen it, I still get an error saying the page is in use if I try to delete it in the UI.
Copy link to clipboard
a follow up...
If I create the legen, then add a page after it, then remove the legend (with code above) the blank page is appended; it does not repleace thone I am deleting. I think the delete works, but for some reason is triggering something that appends a page.