Update page count after deleting a page

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
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
Capture.PNG (5.5 KiB) Viewed 5499 times
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);
}
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-Tracker Dev Team
Site Admin
Posts: 2352
Joined: Thu Jun 30, 2005 4:11 pm
Location: Canada

Re: Update page count after deleting a page

Post by Vasyl-Tracker Dev Team »

Hi Shaun Luttin.

We will fix that issue in new upcoming build.

Cheers.
Vasyl Yaremyn
Tracker Software Products
Project Developer

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