Foxit ActiveX Tutorial

2y ago
16 Views
2 Downloads
1.31 MB
15 Pages
Last View : 8d ago
Last Download : 3m ago
Upload by : Oscar Steel
Transcription

Foxit ActiveX Tutorial

Foxit PDF ActiveXPro Version DemoContentsPrerequisites .3Developer Audience .3Supported Environments .3Overview.3Purpose .3Setup.3Getting Started: Basic PDF Functions .6Unlocking the SDK .6Opening a PDF File .7Go to a specific page .7Zoom in and out of a page .8Rotate a Page . 10Print a PDF document . 10Hide/Show UI elements. 12Iterate the tree outline of the PDF document . 12Search. 142

Foxit PDF ActiveXPro Version DemoPrerequisitesDeveloper AudienceThis document is targeted towards C/C developers using the Foxit PDF ActiveX SDK. Itassumes the developer is familiar with C/C and Microsoft Foundation Classes (MFC).Supported EnvironmentsPlatformOperating SystemCompilerWindows (32-bit)Windows 2000/XP or laterMicrosoft Visual Studio 6.0and Visual Studio 2010OverviewPurposeThis document covers how to use the Foxit ActiveX SDK. It uses the demo provided byFoxit Corporation as reference for explanation.Setup1. Download the free 30 day trial version of ActiveX Professional ster.php?product ActiveX-Professional2. You will receive an email with a download link for the FoxitPDFSDKActiveX Pro.msi.Download this msi and double click on it to start the installation.3. The files are installed under C:\Program Files (x86)\Foxit Software\Foxit PDF SDKActiveX Pro3

Foxit PDF ActiveXPro Version Demo4. Go to the C:\Program Files (x86)\Foxit Software\Foxit PDF SDK ActiveXPro\demo\vc folder and open up the demo source code. If you are using VisualC 6.0, open up demo.dsw. If you are using Visual Studio 2010, open updemo.sln. The instructions and screenshots in this tutorial will reference VisualStudio 2010.5. The demo.sln file contains 2 demos.AX Pro Demo – A full featured PDF reader with a drop down list of annotationtools.4

Foxit PDF ActiveXPro Version DemoAX Ppo Demo – A full featured PDF reader with a panel for page manipulationfunctions.6. The remainder of this demo will examine the basic functions developers will startwith when using the SDK. Make sure to set AX Pro Demo as the startup project. InVisual Studio 2010, go to the Solution Explorer right click on AX Pro Demo Setas Startup Project.7. Select to build a Debug version of the demo so you will be able to step through thecode.8. Build the demo, Go to Build Build Solution.9. Make sure there are no errors in the build output.10. Run the demo by going to Debug Start Debugging5

Foxit PDF ActiveXPro Version DemoGetting Started: Basic PDF FunctionsThe following sections contain references to the AX Pro Demo. To get a full understandingof how the functions works, the user should set breakpoints and step through the code.File names and line numbers for specific function calls are provided.Unlocking the SDKThe evaluation version of the ActiveX SDK will apply a watermark across any rendered PDFpage. Customers who pay for the SDK will receive a license key to remove the watermark.The license key will contain a license id and an unlock code that you will pass in asparameters to the UnLockActiveX function. There is an example of this inAX Pro DemoDlg.cpp,BOOL CAX Pro DemoDlg::OnInitDialog(){CDialog::OnInitDialog();// codem AX.UnLockActiveX( T("Licence ID"), T("Unlock code"));// code}6

Foxit PDF ActiveXPro Version DemoOpening a PDF FileCall the OpenFile function to open a PDF file for viewing. There is a working example inAX Pro DemoDlg.cpp,void CAX Pro DemoDlg::OnFileOpen(){//codem AX.OpenFile(fdg.GetPathName() ,NULL );// code}The user can trigger the OnFileOpen event by going to File Open browse to a PDF file click on Open or by using the file open folder icon.Go to a specific pageUse the GoToPage function to navigate directly to the page number specified as theparameter. Page indexing is zero based. So call GoToPage(0) to get to the first page.The AX Pro Demo has arrows for navigating to the first, previous, next, and last page of amultipage document. To see these functions in action, run the demo and open a multiplepage PDF.In AX Pro DemoDlg.cpp, you will see the corresponding events that are triggered whenthe arrow buttons for navigating pages are pressed. You will see the GoToPage function iscalled with the appropriate index value.void CAX Pro DemoDlg::OnFirstPage(){m AX.GoToPage(0);}7

Foxit PDF ActiveXPro Version Demovoid CAX Pro DemoDlg::OnLastPage(){int count m AX.GetPageCount();m AX.GoToPage(count-1);}void CAX Pro DemoDlg::OnNextPage(){int count m AX.GetPageCount();int current m AX.GetCurPage();if(current 1 count-1)m AX.GoToPage(current 1);}void CAX Pro DemoDlg::OnPrevPage(){int count m AX.GetPageCount();int current m AX.GetCurPage();if(current-1 0)m AX.GoToPage(current-1);}Zoom in and out of a pageCall SetZoomLevel to zoom in and out of the PDF page. The AX Pro Demo has menubuttons for zoom in, zoom out, actual size, fit page, and fit width. All of these buttonstrigger events that call SetZoomLevel.8

Foxit PDF ActiveXPro Version Demovoid CAX Pro DemoDlg::OnZoomIn(){zoomfactor m AX.GetZoomLevel();if(zoomfactor 10 6400)zoomfactor 6400;elsezoomfactor zoomfactor 10;m AX.SetZoomLevel( zoomfactor );}void CAX Pro DemoDlg::OnZoomOut(){zoomfactor m AX.GetZoomLevel();if(zoomfactor - 10 0)zoomfactor zoomfactor - 10;m AX.SetZoomLevel( zoomfactor );}void CAX Pro DemoDlg::OnActualSize(){m AX.SetZoomLevel(0);}void CAX Pro DemoDlg::OnFitPage(){m AX.SetZoomLevel(1);}void CAX Pro DemoDlg::OnFitWidth(){m AX.SetZoomLevel(2);}9

Foxit PDF ActiveXPro Version DemoRotate a PageCall SetRotate to rotate the PDF page. The AX Pro Demo has menu buttons for rotateright and rotate left. These buttons trigger events that call SetRotate.void CAX Pro DemoDlg::OnRotateRight(){if(rotatefactor 3)rotatefactor 0;elserotatefactor ;m AX.SetRotate(rotatefactor);}void CAX Pro DemoDlg::OnRotateLeft(){if(rotatefactor 0) rotatefactor 3;else rotatefactor--;m AX.SetRotate( rotatefactor );}Print a PDF documentCall PrintWithDialog to bring up the print dialog page. On that page you can manuallyadjust printer settings. Using the ActiveX SDK you can also programmatically set printersettings. Clicking on the printer iconor going to File Print will trigger the OnFilePrint() event that calls the PrintWithDialogfunction to bring up the print dialog settings,10

Foxit PDF ActiveXPro Version Demovoid CAX Pro DemoDlg::OnFilePrint(){CPDFPrinter printer m AX.GetPrinter();if (!printer){return;}//printer.SetPrinterName( "foxit PDF" );printer.SetPrinterRangeMode( 3 );printer.SetPrinterRangeFrom( 2 );printer.SetPrinterRangeTo( 3 );printer.SetPaperSize( 8 );printer.SetNumOfCopies( 2 );printer.PrintWithDialog();}11

Foxit PDF ActiveXPro Version DemoHide/Show UI elementsThe ActiveX SDK provides functions for modifying the user interface. For example, theShowToolBar() function takes a boolean parameter. This is what the user interface lookslike when ShowToolBar(FALSE) is called by the application code,ShowToolBar(TRUE) adds the toolbar to the user interfaceIn AX Pro DemoDlg.cpp, the ShowToolBar function is called with FALSE as the defaultsetting. As an exercise, the user can change m ToolState to be TRUE to enable the toolbarwhen the demo is run.BOOL CAX Pro DemoDlg::OnInitDialog(){// codem ToolState FALSE;// codem AX.ShowToolBar( m ToolState );// code}Iterate the tree outline of the PDF documentIf the user wants to build a table of contents for a PDF document, they can use theGetOutlineFirstChild() and GetOutlineNextSibling() functions to iterate through the outlinetree of the PDF. Here’s an example of a TOC using the AX Pro Demo,12

Foxit PDF ActiveXPro Version DemoIn AX Pro DemoDlg.cpp in the CAX Pro DemoDlg::OnFileOpen() function there is codethat shows how the TOC is generated when the file is first open in the demo. To get acloser understanding, it is recommended that the developer set a breakpoint at thebeginning of this function and step through. See where GetOutlineFirstChild andGetOutlineNextSibling are called.void CAX Pro DemoDlg::OnFileOpen(){// codeCPDFOutline outline;outline m AX.GetOutlineFirstChild( outline.m lpDispatch );if (outline ! NULL){outline ee();13

Foxit PDF ActiveXPro Version Demoif (m outlinetree.GetCount() 0){ShowBookMark();m bhidebookmark TRUE;}else{HideBookMark();m bhidebookmark FALSE;}}SearchThe AX Pro Demo has a search icon in the toolbar that allows a user to search through aPDF for specific words or phrases.This Find dialog box appears when the icon is clicked on,The FindFirstEx() function finds the first occurrence of the string in the PDF document. Theparameters are the search string, a boolean to indicate if the user wants to match case, aBoolean to indicate if the user wants to match the entire word. In FindDlg.cpp in theCFindDlg::OnOK() function there is an working example of FindFirstEx() and FindNext().void CFindDlg::OnOK(){UpdateData(true);If (TRUE m bFirst)14

Foxit PDF ActiveXPro Version Demo{// code to initialize the var parameterm pAX- FindFirstEx(var, m check1, m check2);// code}else//FindNext(BOOL) TRUE:down search, FALSE:up searchm pAX- FindNext(TRUE);}15

Visual Studio 2010, go to the Solution Explorer right click on AX_Pro_Demo Set as Startup Project. 7. Select to build a Debug version of the demo so you will be able to step through the code. 8. Build the demo, Go to Build Build Solution. 9. Make sure there are no errors in the build

Related Documents:

Foxit PDF SDK ActiveX uses the same parsing and rendering engine as Foxit Reader. Therefore it can display PDF files with the same high quality and fast speed as Foxit Reader. Compared to the DLL version of Foxit SDK, the ActiveX version is much easier to use and has much more rich features built inside. A programmer can simply drag and drop the

Foxit Reader (MSI) Overview Foxit Reader (MSI), hereafter referred to as Foxit Reader, is a PDF document viewer and printer. It launches quickly and is easy to install. Just run "Foxit Reader Setup.msi" and then follow the installation guides to complete installation. Foxit Reader enables users to create, edit and secure reliable PDF .

Foxit PDF Creator 3.0 User Manual 1 Chapter One - Introduction to Foxit PDF Creator Foxit PDF Creator is a small, fast and easy PDF creation tool that converts any type of printable Windows document, including DOC, XLS, PPT, TXT, E-MAIL and

Foxit PhantomPDF Business for Asus User Manual. 8 . Chapter 2 – Get Started . The Foxit PhantomPDF . Business. workspace is packed with tools that help make working with PDF files easier, and is organized into a document pane, a navigation pane, toolbar pane, menu bar and status bar. A good way to get up to speed in using Foxit PhantomPDF

Foxit PhantomPDF Express User Manual 6 Foxit PhantomPDF Express Foxit PhantomPDF Express provides the high end features you need for free. It is small, incredibly fast, and highly accurate for converting popular file formats to professional quality PDF documents

Foxit PhantomPDF Standard User Manual 9 Select the plug-in to be uninstalled, and click the Uninstall button to uninstall it. Note: 1. All the operations to the plug-ins will take effect after you restart Foxit PhantomPDF. 2. Foxit PhantomPDF includes plug-ins that are

Foxit hereunder is limited to the most current version of the Product and the immediately preceding version. 4.3. Exclusions. Foxit’s obligation to provide Support is contingent upon proper use of the Product and full compliance with this Agreement. Moreover, Foxit shall be under no obligation to provide Support should such services be

term(s) provided You (a) are current on all payments due to Foxit Corporation and (b) pay Foxit Corporation, or its authorized agent, the applicable renewal fee, which Foxit Corporation, or its authorized agent, shall invoice prior to the end of the preceding