ebook img

Foxit Reader ActiveX SDK 2.4 Programming Guide PDF

45 Pages·2008·0.76 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Foxit Reader ActiveX SDK 2.4 Programming Guide

Programming Guide Foxit Reader ActiveX SDK 2.4 Programming Guide ©2010 Foxit Corporation. All Rights Reserved. Programming Guide Copyright © 2010 Foxit Corporation. All Rights Reserved. No part of this document can be reproduced, transferred, distributed or stored in any format without the prior written permission of Foxit. A nti-Grain Geometry - Version 2.3, Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com). FreeType2 (freetype2.2.1), Copyright (C) 1996-2001, 2002, 2003, 2004| David Turner, Robert Wilhelm, and Werner Lemberg. LibJPEG (jpeg V6b 27- Mar-1998), Copyright (C) 1991-1998 Independent JPEG Group. ZLib (zlib 1.2.2), Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler. Little CMS, Copyright (C) 1998-2004 Marti Maria. Kakadu, Copyright (C) 2001, David Taubman, The University of New South Wales (UNSW). PNG, Copyright (C) 1998-2009 Glenn Randers-Pehrson. LibTIFF, Copyright (C) 1988-1997 Sam Leffler and Copyright (C) 1991-1997 Silicon Graphics, Inc. Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided "as is" without express or im-plied warranty, and with no claim as to its suitability for any purpose. Programming Guide Overview Foxit Reader ActiveX SDK is a visual programming component that offers PDF displaying capability with minimal resource demand and re-distribution size. It can be easily integrated into a wide range of applications. Foxit Reader ActiveX SDK 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 rich features built inside it. A programmer can simply drag and drop the component into their application and instantly add PDF displaying functionality to the application. The ActiveX allows users to navigate, zoom, rotate, scroll and print out PDF documents. Version 2.4 incorporates advanced PDF features. It supports annotation and allows users to fill out, import or export PDF forms. Version 2.4 exposes more functions and events, giving programmers flexible control over the component and more access to the PDF documents. Foxit offers two versions of ActiveX 2.4. One is the standard version that offers all but the following features: creating/editing annotation, importing/exporting form data, running JavaScript, converting PDF to text, etc. The other one is the professional version that includes all the features. You may choose the version that’s right for you based on the requirements of your application. For standard version, you may simply purchase it online. For professional version, you need to contact [email protected] to discuss licensing details. In this developer’s guide, we mark all properties and functions that are available only in professional version with an asterisk (*). Foxit Reader ActiveX SDK runs on Windows 95/NT or later OS. It is a stand-alone component and does not require extra PDF software such as Foxit Reader installed. A user might need to have the administrator’s right in order to successfully register the ActiveX under Windows. There are several complete demo programs written in different languages, including Visual Basic, Visual C++, Delphi, showing how to use the properties and methods of the ActiveX. You may download them from website www.foxitsoftware.com . UNLOCK Code: If you have purchased Foxit Reader ActiveX SDK and received the full version of the ActiveX and the unlock code, you should call UnLockActiveX function once inside your program, before you call ANY other functions of the ActiveX. Programming Guide This function is described in the Reference section. You don’t need to call this function if you just want to evaluate the ActiveX. Programming Guide Tutorials The Foxit Reader SDK ActiveX control comes with a single OCX file. To install it, please use command "regsvr32 foxitreader_ax.ocx". You may need to specify proper path if foxitreader_ax.ocx is not stored in current directory. The ActiveX control handles user interface for you. It also supplies many properties and methods so that your application is able to control the ActiveX. In the following example, suppose we have already created an ActiveX control called FoxitReaderSDK. 1) Open a PDF File We will open a PDF document named “testdoc.pdf” // NOTE: If you are evaluating ActiveX, you don’t need to unlock it, // then evaluation marks will be shown on all PDF pages, // otherwise, for paid customers, please unlock the ActiveX first FoxitReaderSDK.UnLockActiveX(“license_id”,”unlock_code”); FoxitReaderSDK.OpenFile(“testdoc.pdf”,””); 2) Go to a specific page We will go to the third page of the document FoxitReaderSDK.GoToPage(2). //The index of first page is 0. 3) Zoom a page If you want to show a PDF page with its original size, you can use the following code in VC: FoxitReaderSDK.SetZoomLevel(0); Or FoxitReaderSDK. SetZoomLevel(100); If you want to set the zoom factor to 200%, use the following code: FoxitReaderSDK. SetZoomLevel(200); For more information, see Function Reference section of this guide. 4) Rotate a page A PDF page can be displayed in four directions: upright, rotated 90 degree, rotated 180 degree, or rotated 270 degree. To display it in different direction, you only need to call SetRotate () to change the Rotate property. Programming Guide If you want to rotate the page (90 degrees) clockwise, you can use the following code in VC: FoxitReaderSDK. SetRotate(1); 5) Print a PDF document What you need to do is call PrintWithDialog method, and then a print dialog will pop up and user will be able to specify parameters and then print out the PDF document. If you want to print without popping up a dialog, you need to use the PDFPrinter interface. 6) Hide or show UI elements You can call ShowToolBar to show or hide the toolbar. Likewise, you may call ShowBookmark to show or hide the bookmark panel and call ShowStatusBar to show or hide the status bar. If you prefer to build your own toolbar, you may hide the built-in ActiveX toolbar and then create your own outside the ActiveX. 7) Iterate the whole outline tree You can call GetOutlineFirstChild, GetOutlineNextSibling to iterate whole outline tree, then you can get the each outline information from PDFOutline Interface. 8) Search a PDF document You can call FindFirst to find the first instance of the given text in the whole document. If no occurrence is found, then the function returns 0. If an occurrence is found, the function return nonzero value and the occurrence will be highlighted. And then you may call FindNext to search for the next occurrence. If you want to search text inside PDF files without opening and displaying them, you may use FindFileFirst and FindFileNext. 9) Annotations (*) End users may draw lines, circles and other shapes on a PDF document by using different markup tools. Your application may also change CurrentTool property programmatically, for example, to the “Line Tool”. Programming Guide FoxitReaderSDK control This section describes all properties and methods exposed by ActiveX. Please note that the reference shows everything in C syntax. If you use a programming language other than C/C++, you have to follow the syntax of that language. Note: The functions marked with the (*) only apply to the professional version. Properties: FilePath Type: BSTR, read-only Description: Full path to the current opened PDF file. If no PDF file is opened, the property is an empty string. By using function GetFilePath, you can get the value of FilePath (this function can only be used in VC). Password Type: BSTR, read-only Description: Password for the PDF. By calling function GetPassword, you can get the password of this document (this function can only be used in VC). PageCount Type: long, read-only Description: Total number of pages in the current opened PDF file. By calling GetPageCount method, you can get the total number of pages in current document (this function can only be used in VC). CurPage Type: long, read-only Description: Index of the current page of the PDF file. Page index starts from zero for the first page. The function GetCurPage makes available to get current page’s index (this function can only be used in VC). Programming Guide Rotate Type: short, read and write Description: Current rotate orientation, the value can be one of the following: 0 (normal); 1 (rotated 90 degrees clockwise); 2 (rotated 180 degrees); 3 (rotated 90 degrees counter-clockwise). You can set or get the value of Rotate by calling function SetRotate or GetRotate (these function can only be used in VC). Zoomlevel Type: long, read and write Description: Normally, the value of this zoom factor is between 10 and 1600. You may also use the following special values: 0=displaying the page in actual page size, this is same as setting zoom level to 100%. 1=displaying the page with proper zoom level so that the whole page can be fit into the client window. 2=displaying the document with proper zoom level so that the width of the page fit to the client window. To set or get the value of Zoomlevel, you can call function SetZoomlevel or GetZoomlevel (these function can only be used in VC). CurrentTool Type: BSTR, read and write Description: Read and set the current tool. The value can be set to one of following strings: “Hand Tool” “ZoomOut Tool” “ZoomIn Tool” “Select Text Tool” “Find Text Tool” “Snapshot Tool” “Typewriter”(*) “Loupe Tool”(*) “Magnifier”(*) “Annot Tool” (*) “Rectangle Link Tool” (*) Programming Guide “Quadrilateral Link Tool” (*) “Arrow Tool” (*) “Line Tool” (*) “Dimension Tool”(*) “Square Tool” (*) “Rectangle Tool” (*) “Circle Tool” (*) “Ellipse Tool” (*) “Polygon Tool” (*) “Cloudy Tool” (*) “Polyline Tool” (*) “Pencil Tool” (*) “Rubber Tool” (*) “Highlight Tool” (*) “Underline Tool” (*) “Strikeout Tool” (*) “Squiggly Tool” (*) “Caret Tool” (*) “Note Tool” (*) “Push Button Tool” (*) “Check Box Tool” (*) “Radio Button Tool” (*) “Combo Box Tool” (*) “List Box Tool” (*) “Text Field Tool” (*) “Distance Tool” (*) “Perimeter Tool” (*) “Area Tool” (*) “Image Tool”(*) “FileAttachment Tool” (*) “Attach a file” (*) And so on. You can call CountTools to learn how many tools are available in current version of ActiveX, and then call GetToolByIndex to get the tool names. You can also call GetCurrentTool or SetCurrentTool to get or set current tool’s name (these function can only be used in VC). Printer Type: IPDFPrinter, read-only Description: Printer property returns an IPDFPrinter interface that you can use for managing the printer and sending the printout. In your application, you can use function GetPrinter to get this property (this function can only be used in VC). Programming Guide bHasFormFields Type: BOOL , read-only Description: If current document contains form fields, then bHasFormFields is True; otherwise, it is False. To get the value of bHasFormFields, you can use function GetBHasFormFields in your own application (this function can only be used in VC). DocumentInfo Type: IPDFDocumentInfo*, read-only Description: Function GetDocumentInfo returns an IPDFDocumentInfo interface which you can use to retrieve document information such as Author, Creator, Creation Date, Keywords, ModDate, Producer Subject and Title (this function can only be used in VC). bHighlightFormFields Type: BOOL , read and write Description: Setting bHighlightFormFields to True will highlight all interactive form fields thereby having a better visual effects. By calling function SetBHighlightFormFields or GetBHighlightFormFields, you can set or get the value which indicates whether to highlight all interactive form fields or not (these function can only be used in VC). FormFieldsHighlightAlpha Type: short, read and write Description: Represent 256 levels of transparency of form field highlight color. 0=transparent; 255=opaque. You can set or get access to the value of highlight alpha of form fields by using function SetFormFieldsHighlightAlpha or GetFormFieldHighlightAlpha (these function can only be used in VC). FormFieldsHighlightColor Type: OLE_COLOR, read and write Description: Represent highlight color of form fields. You can call SetFormFieldsHighlightColor

Description:
Foxit Reader ActiveX SDK 2.4 Programming Guide ©2010 Foxit Corporation. The Foxit Reader SDK ActiveX control comes with a single OCX file. To install it,
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.