Page 1 of 1

Update page count after deleting a page

Posted: Tue May 08, 2018 8:59 pm
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 5557 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);
}

Re: Update page count after deleting a page

Posted: Tue May 08, 2018 10:47 pm
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.

Re: Update page count after deleting a page

Posted: Fri Jun 08, 2018 5:09 pm
by Vasyl-Tracker Dev Team
Hi Shaun Luttin.

We will fix that issue in new upcoming build.

Cheers.