1 Reply Latest reply on May 23, 2011 1:53 PM by John Hawkinson

    Hide/Remove/Detach page

    xmlapi Level 1

      I need to temporarily hide/remove/detach a page so I can export the template and then later show/add/attach the page again so I can export it (this time with the page).

       

      How do I do this using a script?

       

      I tried this but doesn:

       

      List<Page> pages = new Page(); //Pages to temporarily remove and hold till the first export is done

      pages.Add(document.Pages[1]);

       

      document.Pages[1].Delete();

      document.Export();

       

      document.Pages.Add(pages[0]);

       

      This throws a null reference error because when the page is deleted, it destroys the reference in List<Page> pages as well.

        • 1. Re: Hide/Remove/Detach page
          John Hawkinson Level 5

          This is not a good workflow.

          You cannot temporarily remove a page -- once you remove it is gone for good -- unless it is still in the Undo history, but I would not feel comfortable relying on that in production.

           

          The obvious answer is to simply export the page first.

           

          If for some reason that is not workable, I would Save As to a temporary file, delete the page, and then revert to my saved temporary file.