Foxit PDF SDK ActiveX 5.1 User manual

Type
User manual
Programming Guide
1
Programming Guide
2
Contents
Contents............................................................................................................................. 2
Overview ........................................................................................................................... 17
Tutorials ............................................................................................................................ 19
Std & Pro Version ..................................................................................................... 19
1. Open a PDF File .......................................................................................... 19
2. Go to a specific page ................................................................................... 19
3. Zoom a page ................................................................................................ 19
4. Rotate a page............................................................................................... 20
5. Print a PDF document .................................................................................. 20
6. Hide or show UI elements ............................................................................ 20
7. Iterate the whole outline tree ....................................................................... 20
8. Search a PDF document.............................................................................. 20
Signature Module ..................................................................................................... 21
Annotations Tools .................................................................................................... 21
Form Application ...................................................................................................... 21
IFoxitPDFSDK ................................................................................................................... 23
Properties .................................................................................................................. 23
1) FilePath ........................................................................................................ 23
2) Password ..................................................................................................... 23
3) PageCount ................................................................................................... 23
4) CurPage ....................................................................................................... 23
5) Rotate ........................................................................................................... 24
6) Zoomlevel ..................................................................................................... 24
7) CurrentTool ................................................................................................... 24
8) Printer ........................................................................................................... 26
9) DocumentInfo ............................................................................................... 26
10) ActiveXVersion ...................................................................................... 26
11) *bHasFormFields .................................................................................. 26
12) *bHighlightFormFields .......................................................................... 27
13) *FormFieldsHighlightAlpha ................................................................... 27
14) *FormFieldsHighlightColor .................................................................... 27
Method ....................................................................................................................... 27
1. Unlock .......................................................................................................... 27
1) UnLockActiveX ..................................................................................... 27
2) UnLockActiveXEx ................................................................................. 28
3) *RemoveEvaluationMark ...................................................................... 28
Programming Guide
3
2. Global Settings ............................................................................................. 28
1) SetCurrentLanguage ............................................................................ 28
2) SetCurrentLanguageByString............................................................... 30
3) SetModulePath ..................................................................................... 31
4) SetCrashLog ......................................................................................... 31
5) SetLogFile ............................................................................................. 32
3. Open and close PDF File ............................................................................. 32
1) OpenFile ............................................................................................... 32
2) OpenMemFile ....................................................................................... 32
3) OpenBuffer ............................................................................................ 33
4) OpenStream ......................................................................................... 33
5) OpenCustomFile ................................................................................... 33
6) OpenFtpFile .......................................................................................... 34
7) CloseFile ............................................................................................... 34
8) SetFileStreamOption ............................................................................ 34
9) OpenFileAsync ..................................................................................... 35
10) *SetAsyncFileLen .......................................................................... 35
11) *OpenAsyncFile ............................................................................. 35
12) *SetAsyncFileData ........................................................................ 36
4. Navigation .................................................................................................... 36
1) ExistForwardStack ................................................................................ 36
2) GoForwardStack ................................................................................... 36
3) ExistBackwardStack ............................................................................. 37
4) GoBackwardStack ................................................................................ 37
5) SetViewRect ......................................................................................... 37
6) ConvertClientCoordToPageCoord ........................................................ 38
7) ConvertClientCoordToPageCoordEx .................................................... 38
8) ConvertPageCoordToClientCoord ........................................................ 39
9) GotoPageDest ...................................................................................... 40
10) GoToPagePos ............................................................................... 40
11) GetVisibleLeftTopPage .................................................................. 40
12) ScrollView ...................................................................................... 40
13) GetScrollLocation .......................................................................... 41
14) GetScrollLocationEx ...................................................................... 41
15) GoToPage ...................................................................................... 41
16) GoToNextPage .............................................................................. 42
17) GoToPrevPage .............................................................................. 42
5. View .............................................................................................................. 42
Programming Guide
4
1) AboutBox .............................................................................................. 42
2) ShowDocumentInfoDialog .................................................................... 43
3) SetPDFMeasureUnit ............................................................................. 43
4) GetPageWidth ...................................................................................... 43
5) GetPageHeight ..................................................................................... 43
6) CountTools ............................................................................................ 44
7) GetToolByIndex .................................................................................... 44
8) ForceRefresh ........................................................................................ 44
9) *IsDualPage .......................................................................................... 45
10) *Highlight ....................................................................................... 45
11) *RemoveAllHighlight ...................................................................... 45
6. Hyperlink ...................................................................................................... 46
1) CountHyperLinks .................................................................................. 46
2) HighlightHyperLink ................................................................................ 46
3) GetHyperLinkRect ................................................................................ 46
4) GetHyperLinkInfo .................................................................................. 47
5) EnableHyperLink .................................................................................. 47
7. Text ............................................................................................................... 47
1) GetPageText ......................................................................................... 47
2) *GetPageTextW .................................................................................... 48
3) GetSelectedRectByIndex ..................................................................... 48
4) GetSelectedRectsCount ....................................................................... 48
5) GetSelectedText ................................................................................... 49
6) GetSelectedTextEx ............................................................................... 49
7) *LoadPDFTextDoc ................................................................................ 49
8) *ExtractTextFromPDF ........................................................................... 49
8. Save ............................................................................................................. 50
1) SaveAs .................................................................................................. 50
2) Save ...................................................................................................... 50
3) SaveToStream ...................................................................................... 51
4) *UploadCurFileToFTP ........................................................................... 51
9. Custom UI .................................................................................................... 51
1) ShowTitleBar ......................................................................................... 51
2) ShowToolBar ......................................................................................... 52
3) ShowToolbarButton............................................................................... 52
4) ShowStatusBar ..................................................................................... 52
5) EnableToolTip ....................................................................................... 52
6) ShowNavPanelByString ....................................................................... 53
Programming Guide
5
7) ShowNavigationPanels ......................................................................... 53
8) GetPanelStatus ..................................................................................... 53
9) SetLayoutShowMode ........................................................................... 54
10) GetLayoutShowMode .................................................................... 54
11) SetFacingCoverLeft ....................................................................... 54
12) *ShowContextMenu ....................................................................... 55
13) *ShowFormFieldsMessageBar ...................................................... 55
14) *SetSigContextMenuString ........................................................... 55
10. Print ....................................................................................................... 56
1) PrintWithDialog ..................................................................................... 56
2) OpenMemFileForPrinter ....................................................................... 56
3) OpenFileForPrinter ............................................................................... 56
11. Search ................................................................................................... 56
1) FindFirst ................................................................................................ 56
2) FindFirstEx ............................................................................................ 57
3) FindNext ................................................................................................ 57
4) FindFileFirst .......................................................................................... 58
5) FindFileFirstEx ...................................................................................... 58
6) FindFileNext .......................................................................................... 59
7) GoToSearchResult ................................................................................ 59
8) FindPageNext ....................................................................................... 59
9) FindClose .............................................................................................. 60
10) FindPageFirst ................................................................................ 60
11) FindMemFileFirst ........................................................................... 60
12) *SearchAndHighlightAllTextOnPage ............................................. 60
12. Bookmark .............................................................................................. 61
1) GetOutlineFirstChild ............................................................................. 61
2) GetOutlineNextSibling .......................................................................... 61
13. Security ................................................................................................. 61
1) GetDocPermissions .............................................................................. 61
2) * CheckOwnerPassword ....................................................................... 62
3) *SetOwnerPassword............................................................................. 62
4) *SetUserPermission.............................................................................. 62
5) *SetUserPassword ................................................................................ 62
14. Annotation ............................................................................................. 63
1) *ExportAnnotsToFDFFile ...................................................................... 63
2) *ImportAnnotsFromFDFFile .................................................................. 63
3) *SetBDrawAnnot ................................................................................... 63
Programming Guide
6
4) *ShowAllPopup ..................................................................................... 64
5) ^GetPageAnnots ................................................................................... 64
6) ^GetFormatTool .................................................................................... 64
15. Form ...................................................................................................... 64
1) *ExportFormToFDFFile ......................................................................... 64
2) *ImportFormFromFDFFile .................................................................... 65
3) *FindFormFieldsTextFirst ...................................................................... 65
4) *FindFormFieldsTextNext ..................................................................... 65
5) * SubmitForm ........................................................................................ 66
6) #GetCurrentForm .................................................................................. 66
16. Page Organization ................................................................................ 66
1) *InsertPage ........................................................................................... 66
2) *DeletePage .......................................................................................... 67
3) *SwapPage ........................................................................................... 67
4) *SetPageIndex ...................................................................................... 67
5) *SetPageCropBox ................................................................................. 67
6) * SetPageRotate ................................................................................... 68
7) *FlattenPage ......................................................................................... 68
8) *InsertNewPage .................................................................................... 68
9) *ExportPagesToPDF ............................................................................. 69
17. JavaScript ............................................................................................. 69
1) * RunJScript .......................................................................................... 69
2) *ShowDocJsDialog ............................................................................... 69
3) *ShowJsConsoleDialog ........................................................................ 69
18. Multi-Instances ...................................................................................... 70
1) SetCurrentWnd ..................................................................................... 70
2) GetCurrentWnd ..................................................................................... 70
3) GetCtrlInstance ..................................................................................... 70
19. Signature............................................................................................... 71
1) &GetPDFSignatureMgr ......................................................................... 71
2) &GetLastSigModuleError ...................................................................... 71
3) &GetLastSigModuleErrMsg .................................................................. 71
20. Others ................................................................................................... 71
1) *AddImageObject .................................................................................. 71
2) *GetBitmap............................................................................................ 72
3) *AddWaterMark ..................................................................................... 73
4) * GetBarcodeBitmap ............................................................................. 73
5) * ConvertPDFPageToImage ................................................................. 74
Programming Guide
7
6) *ImportImageToPdf ............................................................................... 74
7) *SetContextMenuString ........................................................................ 75
Event .......................................................................................................................... 75
1) BeforeDraw .................................................................................................. 75
2) AfterDraw ..................................................................................................... 75
3) OnZoomChange .......................................................................................... 76
4) OnPageChange ........................................................................................... 76
5) OnOpenPassword ........................................................................................ 76
6) OnSearchProgress ...................................................................................... 76
7) OnOpenFile .................................................................................................. 76
8) OnOpenDocument ....................................................................................... 77
9) OnFilePathInvalidate .................................................................................... 77
10) OnShowSavePrompt ............................................................................ 77
11) OnCloseDocument ............................................................................... 77
12) OnDocumentChange ............................................................................ 78
13) CustomFileGetSize ............................................................................... 78
14) CustomFileGetBlock ............................................................................. 78
15) OnClick ................................................................................................. 78
16) OnDbClick ............................................................................................. 79
17) OnRButtonClick .................................................................................... 79
18) OnDownLoadFinish .............................................................................. 79
19) OnErrorOccurred .................................................................................. 79
20) OnUploadFinish .................................................................................... 80
21) OnTextHyperLink .................................................................................. 80
22) OnExcuteMenuItem .............................................................................. 80
23) OnDoGoToRAction ............................................................................... 80
24) *OnHyperLink ....................................................................................... 81
25) *OnContextMenuIndex ......................................................................... 81
26) *OnAddMenuItemAction ....................................................................... 82
27) #FormFieldError .................................................................................... 82
28) *OnFetchAsyncFileData ....................................................................... 82
29) *OnCurPageIndexChanged .................................................................. 82
30) *OnSigContextMenuIndex .................................................................... 83
ILink_Dest ......................................................................................................................... 84
Method ....................................................................................................................... 84
1) GetPageIndex .............................................................................................. 84
2) GetZoomMode ............................................................................................. 84
3) GetZoomParamCount .................................................................................. 84
Programming Guide
8
4) GetZoomParam............................................................................................ 84
5) GetDestName .............................................................................................. 84
IPDFAction ........................................................................................................................ 86
Method ....................................................................................................................... 86
1) GetURIPath .................................................................................................. 86
2) GetFilePath .................................................................................................. 86
3) GetType ........................................................................................................ 86
4) GetDest ........................................................................................................ 86
IPDFOutline ...................................................................................................................... 87
Method ....................................................................................................................... 87
1) GetOutlineDest............................................................................................. 87
2) GetOutlineAction .......................................................................................... 87
3) GetOutlineColor ........................................................................................... 87
4) NavigateOutline ........................................................................................... 87
5) GetOutlineTitle ............................................................................................. 88
6) GetOutLineTitle2 .......................................................................................... 88
7) GetOutlineExpandValue ............................................................................... 88
IFindResult ....................................................................................................................... 89
Method ....................................................................................................................... 89
1) GetFindRectsCount ..................................................................................... 89
2) GetFindRectByIndex .................................................................................... 89
3) GetFindPageNum ........................................................................................ 89
4) GetFindFileName ......................................................................................... 90
5) GetFindString ............................................................................................... 90
IPDFPrinter ....................................................................................................................... 91
Properties .................................................................................................................. 91
1) PrinterName ................................................................................................. 91
2) PrinterRangeMode ....................................................................................... 91
3) PrinterRangeFrom ....................................................................................... 91
4) PrinterRangeTo ............................................................................................ 91
5) NumOfCopies............................................................................................... 92
6) Scaling ......................................................................................................... 92
7) AutoRotate ................................................................................................... 92
8) AutoCenter ................................................................................................... 92
9) Collate .......................................................................................................... 92
10) Rotation ................................................................................................. 93
11) RangeSubset ........................................................................................ 93
12) ReversePage ........................................................................................ 93
Programming Guide
9
13) PageBorder ........................................................................................... 93
14) PrintWhat .............................................................................................. 93
Methods ..................................................................................................................... 94
1) PrintWithDialog ............................................................................................ 94
2) PrintQuiet ..................................................................................................... 94
3) SetPaperSize ............................................................................................... 94
4) GetSystemPrinterCount ............................................................................... 94
5) GetSystemPrinterNameByIndex .................................................................. 95
6) SetPaperSizeByPage .................................................................................. 95
IPDFDocumentInfo .......................................................................................................... 96
Properties .................................................................................................................. 96
1) Author ........................................................................................................... 96
2) Subject ......................................................................................................... 96
3) CreatedDate ................................................................................................. 96
4) ModifiedDate ................................................................................................ 96
5) Keywords ..................................................................................................... 96
6) Creator ......................................................................................................... 97
7) Producer ....................................................................................................... 97
8) Title ............................................................................................................... 97
#IPDFForm ........................................................................................................................ 98
Method ....................................................................................................................... 98
1) #AddField ..................................................................................................... 98
2) #RemoveFieldsByName .............................................................................. 98
3) #ExportToFDF .............................................................................................. 99
4) #ImportFromFDF ......................................................................................... 99
5) #GetFieldByIndex ........................................................................................ 99
6) #GetFieldsCount ........................................................................................ 100
7) #RemoveField ............................................................................................ 100
#IPDFFormField ............................................................................................................. 101
Properties ................................................................................................................ 101
7) #Alignment ................................................................................................. 101
8) #BorderStyle .............................................................................................. 101
9) #BorderWidth ............................................................................................. 101
10) #ButtonLayout ..................................................................................... 102
11) #CalcOrderIndex ................................................................................. 102
12) #CharLimit........................................................................................... 102
13) #DefaultValue...................................................................................... 102
14) #IsEditable .......................................................................................... 103
Programming Guide
10
15) #Behavior ............................................................................................ 103
16) #IsHidden ............................................................................................ 103
17) #IsMultiline .......................................................................................... 103
18) #IsPassword ....................................................................................... 104
19) #IsReadOnly ....................................................................................... 104
20) #IsRequired ........................................................................................ 104
21) #Name ................................................................................................ 104
22) #NoViewFlag....................................................................................... 104
23) #PrintFlag............................................................................................ 105
24) #Style .................................................................................................. 105
25) #TextFont ............................................................................................ 105
26) #TextSize ............................................................................................ 106
27) #Type .................................................................................................. 106
28) #Value ................................................................................................. 107
29) #Tooltip ................................................................................................ 107
30) #Orientation ........................................................................................ 107
31) #DirtyFlag............................................................................................ 107
Method ..................................................................................................................... 108
1) #PopulateListOrComboBox ....................................................................... 108
2) #SetBackgroundColor ................................................................................ 108
3) #SetBorderColor ........................................................................................ 108
4) #SetForegroundColor ................................................................................ 109
5) #SetButtonCaption ..................................................................................... 109
6) #SetButtonIcon........................................................................................... 110
7) #SetExportValues....................................................................................... 110
8) #SetJavaScriptAction ................................................................................. 110
9) #SetResetFormAction ................................................................................ 111
10) #SetSubmitFormAction ....................................................................... 111
11) #GetPageIndex ................................................................................... 112
12) #GetRectTop ....................................................................................... 112
13) #GetRectLeft ....................................................................................... 112
14) #GetRectRight .................................................................................... 113
15) #GetRectBottom ................................................................................. 113
^IPDFPageAnnots .......................................................................................................... 114
Method ..................................................................................................................... 114
1) ^GetAnnot .................................................................................................. 114
2) ^AddAnnot .................................................................................................. 114
3) ^RemoveAnnot ........................................................................................... 115
Programming Guide
11
4) ^GetAnnotIndex ......................................................................................... 115
5) ^GetAnnotsCount ....................................................................................... 115
^IPDFAnnot ..................................................................................................................... 116
Properties ................................................................................................................ 116
1) ^Thickness ................................................................................................. 116
2) ^BorderStyle ............................................................................................... 116
3) ^Color ......................................................................................................... 117
4) ^LineStartingStyle ...................................................................................... 117
5) ^LineEndingStyle ....................................................................................... 117
6) ^FillColor .................................................................................................... 118
7) ^Opacity ..................................................................................................... 118
8) ^Author ....................................................................................................... 118
9) ^Subject ...................................................................................................... 119
10) ^CreationDate ..................................................................................... 119
11) ^ModificationDate ............................................................................... 119
12) ^Locked ............................................................................................... 119
13) ^Print ................................................................................................... 120
14) ^ReadOnly .......................................................................................... 120
15) ^Description ........................................................................................ 120
Methods ................................................................................................................... 120
1) ^GetType .................................................................................................... 120
2) ^GetSubType ............................................................................................. 121
3) ^GetContents ............................................................................................. 121
4) ^SetContents .............................................................................................. 121
5) ^IsPopupOpen ........................................................................................... 121
6) ^SetPopupOpen ......................................................................................... 122
7) ^HasPopup ................................................................................................. 122
8) ^GetRect .................................................................................................... 122
9) ^SetRect ..................................................................................................... 122
10) ^SetLinkGoToAction ........................................................................... 123
11) ^SetLinkURLAction ............................................................................. 123
12) ^DoAction ............................................................................................ 123
13) ^HasAction .......................................................................................... 124
14) ^GetMarkedState ................................................................................ 124
15) ^SetMarkedState ................................................................................ 124
16) ^GetReviewState ................................................................................ 124
17) ^SetReviewState ................................................................................ 125
18) ^GetMigrationState ............................................................................. 125
Programming Guide
12
19) ^SetMigrationState ............................................................................. 126
20) ^SetStartingPoint ................................................................................ 126
21) ^GetStartingPoint ................................................................................ 126
22) ^SetEndingPoint ................................................................................. 127
23) ^GetEndingPoint ................................................................................. 127
24) ^SetMediaPoster ................................................................................ 127
25) ^SetMultimedia ................................................................................... 127
26) ^SetLinkQuadPoints ........................................................................... 128
27) ^SetPolygonVertices ........................................................................... 128
28) ^SetPencilVertices .............................................................................. 128
29) ^AttachFile .......................................................................................... 129
30) ^ GetReplyList ..................................................................................... 129
31) ^ UpdateAnnotReplies ........................................................................ 129
Events ...................................................................................................................... 129
1) ^OnAnnotCreated ...................................................................................... 129
2) ^OnAnnotDeleted ....................................................................................... 130
3) ^OnAnnotModified ...................................................................................... 130
4) ^OnAnnotReplyCreated ............................................................................. 130
5) ^OnAnnotReplyDeleted ............................................................................. 130
6) ^OnAnnotReplyModified ............................................................................ 131
7) ^OnAnnotRButtonDown ............................................................................. 131
8) ^OnAnnotRButtonUp ................................................................................. 131
9) ^OnAnnotLButtonDbClick .......................................................................... 132
10) ^OnAnnotMoving ................................................................................ 132
11) ^OnAnnotMouseEnter ........................................................................ 133
12) ^OnAnnotMouseExit ........................................................................... 133
^ IPDFAnnotReplyList ................................................................................................... 134
Methods ................................................................................................................... 134
1) ^ GetCount ................................................................................................. 134
2) ^ GetItem .................................................................................................... 134
3) ^ Remove ................................................................................................... 134
4) ^ RemoveAll ............................................................................................... 134
5) ^ Add .......................................................................................................... 135
^IPDFAnnotReply ........................................................................................................... 136
Methods ................................................................................................................... 136
1) ^ SetCreator ............................................................................................... 136
2) ^ GetCreator ............................................................................................... 136
3) ^ SetContent .............................................................................................. 136
Programming Guide
13
4) ^ GetContent .............................................................................................. 136
5) ^ GetChildren ............................................................................................. 136
6) ^ GetParent ................................................................................................ 137
7) ^ GetCreationDate ..................................................................................... 137
8) ^ SetCreationDate ...................................................................................... 137
9) ^ SetReadonly ............................................................................................ 137
10) ^ GetReplyID ....................................................................................... 138
^IPDFormatTool ............................................................................................................. 139
Method ..................................................................................................................... 139
1) ^SetFontName ........................................................................................... 139
2) ^GetFontName ........................................................................................... 139
3) ^SetFontSize .............................................................................................. 139
4) ^GetFontSize ............................................................................................. 140
5) ^SetFontColor ............................................................................................ 140
6) ^GetFontColor ............................................................................................ 140
7) ^SetBorderColor ......................................................................................... 140
8) ^GetBorderColor ........................................................................................ 141
9) ^SetFillColor ............................................................................................... 141
10) ^GetFillColor ....................................................................................... 141
11) ^SetFontBold ...................................................................................... 141
12) ^GetFontBold ...................................................................................... 142
13) ^GetFontBoldEnable ........................................................................... 142
14) ^SetFontItalic ...................................................................................... 142
15) ^GetFontItalic ...................................................................................... 143
16) ^GetFontItalicEnable .......................................................................... 143
17) ^SetAlign ............................................................................................. 143
18) ^GetAlign ............................................................................................ 143
19) ^SetCharSpace ................................................................................... 144
20) ^GetCharSpace .................................................................................. 144
21) ^SetCharHorzScale ............................................................................ 144
22) ^GetCharHorzScale ............................................................................ 144
&IPDFSignatureMgr ....................................................................................................... 146
Method ..................................................................................................................... 146
1) &Add........................................................................................................... 146
2) &SignDocument ......................................................................................... 146
3) &Verify ........................................................................................................ 147
4) &GetCounts ................................................................................................ 147
5) &Get ........................................................................................................... 148
Programming Guide
14
6) &Clear ........................................................................................................ 148
7) &Remove ................................................................................................... 148
8) &VerifyAll .................................................................................................... 148
9) &InitStraddleValue...................................................................................... 149
10) &CreatePatternSigField ...................................................................... 149
11) &SetCurPattenSigField ....................................................................... 149
&IPDFSignatureField ..................................................................................................... 150
Properties ................................................................................................................ 150
1) &Reason .................................................................................................... 150
2) &Location ................................................................................................... 150
3) &Signer ...................................................................................................... 150
4) &Filter ......................................................................................................... 150
5) &SubFilter .................................................................................................. 151
6) &State ........................................................................................................ 151
Methods ................................................................................................................... 151
1) &SetAPOptions .......................................................................................... 151
2) &SetAPText ................................................................................................ 152
3) &SetAPImage............................................................................................. 152
4) &IsSigned ................................................................................................... 153
5) &SetSignerDN ............................................................................................ 153
6) &SetStatusImage ....................................................................................... 153
7) &GetPageIndex .......................................................................................... 154
8) &GetSourceBuffer ...................................................................................... 154
9) &GetSourceBufferLen ................................................................................ 154
10) &GetSignedBuffer ............................................................................... 155
11) &GetSignedBufferLen ......................................................................... 155
12) &CreateSignedDoc ............................................................................. 155
13) &SetVerifyResult ................................................................................. 156
14) &SetCertPath ...................................................................................... 156
15) &SetCertData ...................................................................................... 156
16) &SetCertContext ................................................................................. 157
17) &SetAPImageData .............................................................................. 157
18) &SetStatusImageData ........................................................................ 158
19) &TurnGray .......................................................................................... 158
20) &TurnBlur ............................................................................................ 159
21) &SetVisible .......................................................................................... 159
22) &GrayPrint .......................................................................................... 159
23) &SetStraddleType ............................................................................... 159
Programming Guide
15
24) &SetStraddlePos ................................................................................ 160
25) &SetStraddleBitmap ........................................................................... 160
26) &SetStraddlePages ............................................................................ 161
27) &SetStraddleFirstPagePercent .......................................................... 161
28) &SetSigFieldAlpha .............................................................................. 161
29) &Refresh ............................................................................................. 161
Events ...................................................................................................................... 162
1) &OnSetSignatureInfo ................................................................................. 162
2) &OnSigning ................................................................................................ 162
3) &OnVerifying .............................................................................................. 162
4) &OnShowSignaturePropertyDialog ........................................................... 162
*IPDFTextDoc ................................................................................................................. 164
Methods ................................................................................................................... 164
1) *ReleasePDFTextDoc ................................................................................ 164
2) *LoadPDFTextPage ................................................................................... 164
*IPDFTextPage ................................................................................................................ 165
Methods ................................................................................................................... 165
1) *ReleasePDFTextPage .............................................................................. 165
2) *CountChars ............................................................................................... 165
3) *GetChars .................................................................................................. 165
4) *GetCharInfo .............................................................................................. 165
5) *GetCharIndexAtPos .................................................................................. 166
6) *GetNextCharIndexByDirection ................................................................. 166
7) *SelectByRange ......................................................................................... 166
8) *SelectByRectangle ................................................................................... 167
9) *StartSearch ............................................................................................... 167
10) *ExtractLinks ....................................................................................... 168
11) *ExtractPageText ................................................................................ 168
*IPDFCharInfo ................................................................................................................. 169
Properties ................................................................................................................ 169
1) *state .......................................................................................................... 169
2) *fontSize ..................................................................................................... 169
3) *originX ....................................................................................................... 169
4) *originY ....................................................................................................... 169
5) *fontName .................................................................................................. 169
6) *fontAscent ................................................................................................. 170
7) *fontDescent ............................................................................................... 170
Methods ................................................................................................................... 170
Programming Guide
16
1) *GetBBox ................................................................................................... 170
2) *GetMatrix .................................................................................................. 170
*IPDFTextSelection ........................................................................................................ 172
Methods ................................................................................................................... 172
1) *ReleaseTextSelection ............................................................................... 172
2) *GetBBox ................................................................................................... 172
3) *GetChars .................................................................................................. 172
4) *CountPieces ............................................................................................. 172
5) *GetPieceRect............................................................................................ 173
6) *GetPieceCharStart ................................................................................... 173
7) *GetPieceCharCount ................................................................................. 173
*IPDFTextSearch ............................................................................................................ 174
Methods ................................................................................................................... 174
1) *ReleaseTextSearch .................................................................................. 174
2) *FindNext ................................................................................................... 174
3) *FindPrev ................................................................................................... 174
4) *GetSelection ............................................................................................. 174
*IPDFTextLink ................................................................................................................. 175
Methods ................................................................................................................... 175
1) *CountLinks ................................................................................................ 175
2) *GetLink ..................................................................................................... 175
3) *GetSelection ............................................................................................. 175
Contact Us ...................................................................................................................... 176
Programming Guide
17
Overview
Foxit PDF SDK ActiveX is a visual programming component that offers PDF displaying
capability with lowest resource demand and redistribution size. It can be easily integrated
into a wide range of applications.
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.
The ActiveX version is much easier to use and has much more features built inside. A
programmer can simply drag and drop the component into their application and instantly
add PDF displaying functionality. In addition, the ActiveX allows users to navigate, zoom,
rotate, scroll and print out PDF documents.
From version 5.0, ActiveX incorporates Signature Module and many advanced PDF
features. It allows developers to enable their applications to digitally sign PDF documents
using third-party digital certificates located in the Windows system certificate store. It also
supports digital signature verification (which authenticates the source and verifies the
integrity of content of digitally signed PDF documents), signature timestamp, signature
print control, and more.
Foxit offers two versions of ActiveX standard version and professional version, which
are provided with different GUID numbers that allows you to register both versions onto
the same computer and access them with their own GUID. Compared with the
professional version, the standard version doesn’t include the following features:
creating/editing annotation, importing/exporting form data, running JavaScript, converting
PDF to text, Digital Signature, etc. Based on your requirements you are able to pick and
choose which ActiveX version would be best for your application. You can purchase either
the standard or professional version online. For the Form, Annotation, and Signature
Module, please contact at sales@foxitsoftware.com for licensing details. In this
developer’s guide, all the properties and functions marked with an asterisk (*) are
available only in the professional version, all the properties and functions marked with a
hash sign (#) are available only in the Form Module, all the properties and functions
marked with a caret (^) are available only in the Annotation Module, and the properties
and functions marked with an ampersand (&) are only available in Signature Module.
Foxit PDF SDK ActiveX runs on Windows XP or later. This is a standalone component and
Programming Guide
18
does not require any extra PDF software installed. Please note a user might need to have
administrator rights to register the ActiveX under Windows successfully.
ActiveX 5.0 adds many new interfaces to support PDF Signature, which allow users to add,
delete, and print Signature in their PDF documents. The Signature Module is licensed
separately from ActiveX 5.0 Professional. If you would like to use this module, please
contact us at sales@foxitsoftware.com.
UNLOCK Code: If you have purchased Foxit PDF SDK ActiveX and received the full
version of the ActiveX and the unlock code, you should call UnLockActiveX or
UnLockActiveXEx functions once inside your program before you call ANY other functions
of the ActiveX. This function is described in the Reference section. You don’t need to call
this function if you just want to evaluate the ActiveX.
GUID for standard version: 0F6C092B-6E4C-4976-B386-27A9FD9E96A1
GUID for professional version: F53B7748-643C-4A78-8DBC-01A4855D1A10
Programming Guide
19
Tutorials
The Foxit SDK ActiveX Control comes with a single OCX file. To install it, please use
command "regsvr32 OCX name". You may need to specify the proper path if OCX is not
stored in current directory.
The ActiveX Control handles user interface for you. It also supplies multiple properties and
methods so that your application is able to control the ActiveX.
The following is an example, suppose we had already created an ActiveX Control called
FoxitReaderSDK.
Std & Pro Version
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.
// 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);
Programming Guide
20
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.
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 PrintWithDialogmethod, a print dialog will pop up
and you 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 IPDFPrinter
interface.
6. Hide or show UI elements
You can call ShowToolBarto show or hide the toolbar. Likewise, you may call
ShowStatusBarto 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” or GetOutlineNextSibling to iterate the
whole outline tree, allowing you to view the outline information from IPDFOutline
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
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114
  • Page 115 115
  • Page 116 116
  • Page 117 117
  • Page 118 118
  • Page 119 119
  • Page 120 120
  • Page 121 121
  • Page 122 122
  • Page 123 123
  • Page 124 124
  • Page 125 125
  • Page 126 126
  • Page 127 127
  • Page 128 128
  • Page 129 129
  • Page 130 130
  • Page 131 131
  • Page 132 132
  • Page 133 133
  • Page 134 134
  • Page 135 135
  • Page 136 136
  • Page 137 137
  • Page 138 138
  • Page 139 139
  • Page 140 140
  • Page 141 141
  • Page 142 142
  • Page 143 143
  • Page 144 144
  • Page 145 145
  • Page 146 146
  • Page 147 147
  • Page 148 148
  • Page 149 149
  • Page 150 150
  • Page 151 151
  • Page 152 152
  • Page 153 153
  • Page 154 154
  • Page 155 155
  • Page 156 156
  • Page 157 157
  • Page 158 158
  • Page 159 159
  • Page 160 160
  • Page 161 161
  • Page 162 162
  • Page 163 163
  • Page 164 164
  • Page 165 165
  • Page 166 166
  • Page 167 167
  • Page 168 168
  • Page 169 169
  • Page 170 170
  • Page 171 171
  • Page 172 172
  • Page 173 173
  • Page 174 174
  • Page 175 175
  • Page 176 176

Foxit PDF SDK ActiveX 5.1 User manual

Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI