Print Page | Close Window

Navegation Menu C#

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2842
Printed Date: 20 May 25 at 6:22AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Navegation Menu C#
Posted By: DanielDB
Subject: Navegation Menu C#
Date Posted: 03 Mar 14 at 4:14PM
I´ve looking some sample to do this, but i didnt find it, i can load/open a pdf document and view it, but only open the first page, How to do to display the next pages of the document?
I have this code so far:

 string fileName = @"..\..\Test Files\test.pdf";
            int pageNumber = 1;

            // Check to see if the library has been successfully unlocked
            if (qp.Unlocked() == 1)
            {
                // Open the file, get a file handle
                int fileHandle = qp.DAOpenFile(fileName);

                // Get a reference to the first page
                int pageReference = qp.DAFindPage(fileHandle, pageNumber);
--------------

   Thanks in advance





Replies:
Posted By: AndrewC
Date Posted: 04 Mar 14 at 8:18AM
Daniel,

This is the normal way.  Pass you pageNumber into DAFindPage to get a new Handle for page 2.
  
pageNumber = 2;
pageRederence = qp.DAFindPage(fileHandle, pageNumber);

Andrew


Posted By: DanielDB
Date Posted: 04 Mar 14 at 1:56PM
Thanks AndrewC for your answer, but that method is no the best way to solve it, because i manage sometimes documents with 100 o more pages, i'll need put one arrow button for change each page, it must have a way to increment/decrement that value for navegate for all pages with only two arrow buttons( next page/previous page).



Posted By: AndrewC
Date Posted: 05 Mar 14 at 2:37AM
Daniel,

The problem is more of programming issue than a Debenu Quick PDF Library issue.

Put two buttons on your form called PrevPage and NextPage. And then use the following pseudo code to process the button presses to keep track of the currPage and update the image as required.

int currPage = 1;
int pageCount;
string fileName = @"..\..\Test Files\test.pdf";
int fileHandle;

buttonOpenPDFFile_Clicked()
{
            // Check to see if the library has been successfully unlocked
            if (qp.Unlocked() == 1)
            {
                // Open the file, get a file handle
                fileHandle = qp.DAOpenFile(fileName);

                pageCount = qp.DAGetPageCount(fileHandle);
}

buttonPrevPage_Clicked()
{
 if (Page > 1)
 {
   currPage = currPage -1;
   UpdatePage(currPage);
  }
}

buttonNextPage_Clicked()
{
 if (Page < pageCount)
 {
   currPage = currPage + 1;
   UpdatePage(currPage);
  }
}

UpdatePage(int page)
{
    // Get a reference to the first page
    int pageReference = qp.DAFindPage(fileHandle, currPage);

    DrawThePageToScreen(pageReference);
}



Posted By: DanielDB
Date Posted: 05 Mar 14 at 4:02PM
Andrew , it was an excellent solution !!
thanks for share ur knowledge.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk