Update page count after deleting a page

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Shaun Luttin
User
Posts: 20
Joined: Tue Apr 17, 2018 12:13 am

Update page count after deleting a page

Post by Shaun Luttin »

After deleting a page from a PDF, the Navigation Toolbar does not update itself automatically.
Capture.PNG
Expected Behavior:

1. Delete a page.
2. The Navigation Toolbar updates the number of pages.

Actual Behavior:

1. Delete a page.
2. The Navigation Toolbar does not update.
3. Mouse over the Navigation Toolbar.
4. The Navigation Toolbar updates the number of pages.

How do we update the navigation toolbar without having to move the mouse in to it?

We currently delete a page from a PDF document with this C# code:

Code: Select all

public void DeletePages(int documentId, int startIndex, int endIndex) {
    try {
        var rangeText = BuildPageRangeText(startIndex, endIndex);
        _viewer.SetProperty("Operations.DeletePages.RangeType", "Exact");
        _viewer.SetProperty("Operations.DeletePages.RangeText", rangeText);
        _viewer.DoDocumentVerb(documentId, null, "DeletePages", null, out _, (int) PXCVA_Flags.PXCVA_NoUI);

        SaveDocument(documentId);
    }
    catch (COMException ex) {
        _viewer.GetTextFromResult(ex.HResult, out var message);
        throw new Exception(message, ex);
    }
}

// saves the document in place
public void SaveDocument(int documentId) {
    // saves the document in place
    _viewer.SaveDocument(documentId, null, 0, 0);

    // Set the document's modified property to false, to remove the (*) from its tab.
    _viewer.SetDocumentProperty(documentId, "Modified", 0);
}
You do not have the required permissions to view the files attached to this post.
User avatar
Shaun Luttin
User
Posts: 20
Joined: Tue Apr 17, 2018 12:13 am

Re: Update page count after deleting a page

Post by Shaun Luttin »

This remains unsolved. That said, here is a workaround that refreshes the navigation bar:

Code: Select all

_viewer.DoVerb(null, "ExecuteCommand", (object) "TogglePagesNavigationBar", out var _);
_viewer.DoVerb(null, "ExecuteCommand", (object) "TogglePagesNavigationBar", out var _);
Toggling the navigation bar twice refreshes it.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2470
Joined: Thu Jun 30, 2005 4:11 pm

Re: Update page count after deleting a page

Post by Vasyl - PDF-XChange »

Hi Shaun Luttin.

We will fix that issue in new upcoming build.

Cheers.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.