Number of all pages
Question asked by sepideh sobhgol - 7/3/2017 at 5:27 AM
Answered
Hello,
How I can get the number of all pages?the code I wrote below doesnot work.... I also asked another question in my last post but nobody answered...
 
regards
    function documentViewerDocumentLoad(sender, e) {
        document.getElementById("TotalPage").textContent = e.totalPages;
    }

8 Replies

Reply to Thread
1
Pavan Chaudhari Replied
  function documentViewerPrintStart(sender, e) {
            //e.totalPages (total pages)
             log("total pages", "total pages " + e.totalPages + " pages");
        }
Pavan Chaudhari
0
Jeff Replied
How can you get the total  pages when not printing?  I need it for page navigation.
1
Pavan Chaudhari Replied
 <GleamTech:DocumentViewerControl ID="documentViewer" runat="server"          Width="800"          Height="600"
        Resizable="True"
        ClientPrintStart="documentViewer_getPage"/>
---------------------------------------------------------------------------------

 <script type="text/javascript">
function documentViewer_getPage(sender, e) {             //e.totalPages (total pages)             log("total pages", "total pages " + e.totalPages + " pages");         }

  </script>
Pavan Chaudhari
1
Jeff Replied
That's the same code as above.  Wouldn't that just execute when I print?  I don't want to print, I just want to add my own page navigation to move between pages in a document.  Right now, it's mixed into the toolbar.  It would be better as a footer and showing something like Page 1 of 50,  Page 2 of 50, etc.
1
Pavan Chaudhari Replied
page no shown in tool bar.
 Page 1/ 4  like this
Pavan Chaudhari
0
Cem Alacayir Replied
Employee Post Marked As Answer
Jeff,
Use this code to get the number of all pages:

var totalPages = documentViewer.getPageCount();
or in your event handler:

function documentViewerDocumentLoad(sender, e) {
    var documentViewer = sender;
  
    document.getElementById("TotalPage").textContent = documentViewer.getPageCount();
}

0
Jeff Replied
Thank you very much!  That works.
0
Jeff Replied
Did this change?  I notice in the new version there's no longer a documentViewerDocumentLoad but instead a documentViewerDocumentLoaded.  getPageCount no longer returns anything either.

Reply to Thread