PDF Converter and PDF Conversion
site indexcontact usabout us
Support
 
Investintech PDF Viewer Control Methods

Interface of the Investintech PDF Viewer Control is exposed through its methods. In this section you will find details about each method: prototype, description, parameters, return value, how to call a method and some examples of using methods.

OpenPDF
GetPageCount
GetCurrentPage
GoToPage
GetCurrentZoomRatio
SetZoom
RotateView
AboutBox
ClosePDF

OpenPDF

unsigned char OpenPDF(LPCTSTR fileName, LPCTSTR openWithPassword)

Description

The OpenPDF() method opens a PDF file.

Parameters

fileName

The name of the file you want to open.

openWithPassword

The password used to open file if the file is password protected; otherwise empty string.

Returns

Non zero value if file is opened successfully, zero otherwise.

Example

CFrameWnd* parentWnd = new CFrameWnd();
static char BASED_CODE szFilter[] = "PDF Files (*.pdf)|*.pdf";
CString strPathName;
CFileDialog dlg(true, "pdf", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter, this, 0);
if ( IDCANCEL == dlg.DoModal() )
return;
strPathName = dlg.GetPathName();
//create a viewer control dynamically
CDInvestintechPDFViewerControl* pViewer = new CDInvestintechPDFViewerControl();
CRect rect;
GetClientRect(&rect);
// create a view to occupy the client area of the frame
if ( !pViewer->Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, rect, parentWnd, AFX_IDW_PANE_FIRST, NULL) ) {
MessageBox("Failed to create viewer window!");
delete pViewer;
return ;
}
else { //creation successful
pViewer->OpenPDF(strPathName, _T(""));
pViewer->BringWindowToTop();
}

return to top


GetPageCount

unsigned char GetPageCount()

Description

The GetPageCount() method counts number of pages in PDF file.

Parameters

None.

Returns

Total number of pages in PDF file.

return to top


GetCurrentPage

unsigned long GetCurrentPage()

Description

The GetCurrentPage() method is used to obtain page number of currently viewed page in PDF file.

Parameters

None.

Returns

Page number of currently viewed page.

return to top


GoToPage

unsigned char GoToPage( unsigned long pageNumber)

Description

The GoToPage() method is used to go directly to some page in PDF file.

Parameters

pageNumber

Number of page that will be shown.

Returns

Non zero value if PDF file has at least as many pages as pageNumber, zero otherwise.

Example

//assuming that CDInvestintechPDFViewerControl* pViewer is successfully created //and some PDF file is opened
unsigned char numberOfPages;
unsigned long pageNumber = 42;
numberOfPages = pViewer->GetPageCount();
if (pageToGo <= numberOfPages)
pViewer->GoToPage(pageNumber);
else
MessageBox("There is no page 42 in this PDF.");

return to top


GetCurrentZoomRatio

double GetCurrentZoomRatio()

Description

The GetCurrentZoomRatio() method gets current zoom ratio of PDF file.

Parameters

None.

Returns

Current zoom ratio of PDF file as floating point double value. For example, if zoom is set to 75%, returned value will be 0.75 and if zoom is set to 200%, returned value will be 2.00.

return to top


SetZoom

unsigned char SetZoom(LPCTSTR zoomRationOrDescription)

Description

The SetZoom() method sets desired zoom on PDF file.

Parameters

zoomRationOrDescription

String containing zoom percentage. It must have %2.2f%% format, for example 33.33% or 150%. It is also possible to use Fit Width, Fit Page and Actual Size strings to fit page width to window, to fit page height to window or to display page in actual size (i.e. zoomed to 100%).

Returns

Non zero value if zoom ratio is set successfully, zero otherwise.

Example

//assuming that CDInvestintechPDFViewerControl* pViewer is successfully created //and some PDF file is opened
double currentZoomRatio;
Cstring zoomDescription;
currentZoomRatio = pViewer->GetCurrentZoomRatio();
strZoom.Format("%2.2f%%", currentZoomRatio*2);
if (pViewer->SetZoom(strZoom) != 0)
//zoom is successfully doubled
currentZoomRatio = pViewer->GetCurrentZoomRatio();

return to top


RotateView

unsigned char RotateView(short rotateViewDegrees)

Description

The RotateView() method rotates PDF file.

Parameters

rotateViewDegrees

Number of degrees that PDF file will be rotated for.

Returns

Non zero value if file is rotated successfully, zero otherwise.

return to top


AboutBox

void AboutBox()

Description

The AboutBox() method displays information window about InvestintechPDFViewerControl.

Parameters

None.

Returns

None.

Example

CDInvestintechPDFViewerControl* pViewer = new CDInvestintechPDFViewerControl();
pViewer->AboutBox();

return to top


ClosePDF

unsigned char ClosePDF()

Description

The ClosePDF() method closes a PDF file.

Parameters

None.

Returns

Non zero value if file is closed successfully, zero otherwise.

Example

//assuming that CDInvestintechPDFViewerControl* pViewer is successfully created //and some PDF file is opened
if (pViewer->ClosePDF() != 0)
MessageBox("PDF is successfully closed!");

return to top

Quick Site Links
PDF Converter Products   PDF Creation Resources   PDF Conversion Software
 

Convert PDF to Excel, Word and More with Able2Extract !
Able2Extract Professional - Convert Scanned PDF-OCR to Word, Excel + more.
Convert PDF to Word with Able2Doc .
Able2Doc Professional - PDF to Word Converter, including scanned PDF conversion.
Sonic PDF Creator - Create PDF files from any Windows application.

 

PDF Writer Download
Securing PDF data
Watermarking PDF
PDF Creator Product
Adding PDF Passwords
Server-Side PDF Creation

 

PDF to Excel
PDF to Word
PDF to Text
PDF to Doc
PDF to XLS
PDF Server

Search By Keywords

Convert PDF to Word, PDF to Excel, Scanned PDF-OCR, PDF to Doc, PDF to PowerPoint (PPT)
PDF Converter Products, PDF Writer, XPS Converter, PDF Developer Tools, PDF Server, Edit PDF