//
{{Copyright(c)2016 Advanced Delphi Systems Richard Maley Advanced Delphi Systems 12613 Maidens Bower Drive Potomac, MD 20854 USA phone 301-840-1554 dickmaley@advdelphisys.com The code herein can be used or modified by anyone. Please retain references to Richard Maley at Advanced Delphi Systems. If you make improvements to the code please send your improvements to dickmaley@advdelphisys.com so that the entire Delphi community can benefit. All comments are welcome. } unit ads_AcroReader; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : 1.2 // File generated on 3/21/2003 2:53:10 PM from Type Library described below. // ************************************************************************ // // Type Lib: c:\program files\Adobe\Acrobat Reader 5\Acrobat\ActiveX\pdf.ocx (1) // LIBID: {CA8A9783-280D-11CF-A24D-444553540000} // LCID: 0 // Helpfile: // HelpString: Acrobat Control for ActiveX // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\System32\stdole2.tlb) // Errors: // Hint: Parameter 'On' of _DPdf.setShowToolbar changed to 'On_' // Hint: Parameter 'to' of _DPdf.printPages changed to 'to_' // Hint: Parameter 'to' of _DPdf.printPagesFit changed to 'to_' // Hint: Parameter 'On' of _DPdf.setShowScrollbars changed to 'On_' // ************************************************************************ // // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. {$WARN SYMBOL_PLATFORM OFF} {$WRITEABLECONST ON} {$VARPROPSETTER ON} (*UnitIndex Master Index Implementation Section Download Units
Description: ads_AcroReader.pas This unit contains the following routines.
Register TPdf.AboutBox TPdf.CreateControl TPdf.GetControlInterface TPdf.goBackwardStack TPdf.goForwardStack TPdf.gotoFirstPage TPdf.gotoLastPage TPdf.gotoNextPage TPdf.gotoPreviousPage TPdf.InitControlData TPdf.LoadFile TPdf.Print TPdf.printAll TPdf.printAllFit TPdf.printPages TPdf.printPagesFit TPdf.printWithDialog TPdf.setCurrentPage TPdf.setLayoutMode TPdf.setNamedDest TPdf.setPageMode TPdf.setShowScrollbars TPdf.setShowToolbar TPdf.setView TPdf.setViewRect TPdf.setViewScroll TPdf.setZoom TPdf.setZoomScroll
*) interface uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL, Variants; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions PdfLibMajorVersion = 1; PdfLibMinorVersion = 3; LIBID_PdfLib: TGUID = '{CA8A9783-280D-11CF-A24D-444553540000}'; DIID__DPdf: TGUID = '{CA8A9781-280D-11CF-A24D-444553540000}'; DIID__DPdfEvents: TGUID = '{CA8A9782-280D-11CF-A24D-444553540000}'; CLASS_Pdf: TGUID = '{CA8A9780-280D-11CF-A24D-444553540000}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// _DPdf = dispinterface; _DPdfEvents = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// Pdf = _DPdf; // *********************************************************************// // DispIntf: _DPdf // Flags: (4112) Hidden Dispatchable // GUID: {CA8A9781-280D-11CF-A24D-444553540000} // *********************************************************************// _DPdf = dispinterface ['{CA8A9781-280D-11CF-A24D-444553540000}'] function LoadFile(const fileName: WideString): WordBool; dispid 2; procedure setShowToolbar(On_: WordBool); dispid 3; procedure gotoFirstPage; dispid 4; procedure gotoLastPage; dispid 5; procedure gotoNextPage; dispid 6; procedure gotoPreviousPage; dispid 7; procedure setCurrentPage(n: Integer); dispid 8; procedure goForwardStack; dispid 9; procedure goBackwardStack; dispid 10; procedure setPageMode(const pageMode: WideString); dispid 11; procedure setLayoutMode(const layoutMode: WideString); dispid 12; procedure setNamedDest(const namedDest: WideString); dispid 13; procedure printAll; dispid 23; procedure Print; dispid 14; procedure printWithDialog; dispid 15; procedure setZoom(percent: Single); dispid 16; procedure setZoomScroll(percent: Single; left: Single; top: Single); dispid 17; procedure setView(const viewMode: WideString); dispid 18; procedure setViewScroll(const viewMode: WideString; offset: Single); dispid 19; procedure AboutBox; dispid -552; procedure printPages(from: Integer; to_: Integer); dispid 21; procedure printPagesFit(from: Integer; to_: Integer; shrinkToFit: WordBool); dispid 22; procedure setViewRect(left: Single; top: Single; width: Single; height: Single); dispid 20; procedure printAllFit(shrinkToFit: WordBool); dispid 24; procedure setShowScrollbars(On_: WordBool); dispid 25; property src: WideString dispid 1; end; // *********************************************************************// // DispIntf: _DPdfEvents // Flags: (4096) Dispatchable // GUID: {CA8A9782-280D-11CF-A24D-444553540000} // *********************************************************************// _DPdfEvents = dispinterface ['{CA8A9782-280D-11CF-A24D-444553540000}'] end; // *********************************************************************// // OLE Control Proxy class declaration // Control Name : TPdf // Help String : Acrobat Control for ActiveX // Default Interface: _DPdf // Def. Intf. DISP? : Yes // Event Interface: _DPdfEvents // TypeFlags : (34) CanCreate Control // *********************************************************************// TPdf = class(TOleControl) private FIntf: _DPdf; function GetControlInterface: _DPdf; protected procedure CreateControl; procedure InitControlData; override; public function LoadFile(const fileName: WideString): WordBool; procedure setShowToolbar(On_: WordBool); procedure gotoFirstPage; procedure gotoLastPage; procedure gotoNextPage; procedure gotoPreviousPage; procedure setCurrentPage(n: Integer); procedure goForwardStack; procedure goBackwardStack; procedure setPageMode(const pageMode: WideString); procedure setLayoutMode(const layoutMode: WideString); procedure setNamedDest(const namedDest: WideString); procedure printAll; procedure Print; procedure printWithDialog; procedure setZoom(percent: Single); procedure setZoomScroll(percent: Single; left: Single; top: Single); procedure setView(const viewMode: WideString); procedure setViewScroll(const viewMode: WideString; offset: Single); procedure AboutBox; procedure printPages(from: Integer; to_: Integer); procedure printPagesFit(from: Integer; to_: Integer; shrinkToFit: WordBool); procedure setViewRect(left: Single; top: Single; width: Single; height: Single); procedure printAllFit(shrinkToFit: WordBool); procedure setShowScrollbars(On_: WordBool); property ControlInterface: _DPdf read GetControlInterface; property DefaultInterface: _DPdf read GetControlInterface; published property Anchors; property TabStop; property Align; property DragCursor; property DragMode; property ParentShowHint; property PopupMenu; property ShowHint; property TabOrder; property Visible; property OnDragDrop; property OnDragOver; property OnEndDrag; property OnEnter; property OnExit; property OnStartDrag; property src: WideString index 1 read GetWideStringProp write SetWideStringProp stored False; end; procedure Register; resourcestring dtlServerPage = 'Acrobat'; dtlOcxPage = 'Acrobat'; implementation uses ComObj, ads_Exception, ads_TimingTester; Var ProcName : String = 'Unknown'; UnitName : String = 'ads_AcroReader'; //Unit Description UnitIndex Master Index
procedure TPdf.InitControlData; const CControlData: TControlData2 = ( ClassID: '{CA8A9780-280D-11CF-A24D-444553540000}'; EventIID: ''; EventCount: 0; EventDispIDs: nil; LicenseKey: nil (*HR:$80004005*); Flags: $00000000; Version: 401); begin ProcName := 'TPdf.InitControlData';TimeTest_ads.Start( ProcName );Try ControlData := @CControlData; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.CreateControl; procedure DoCreate; begin FIntf := IUnknown(OleObject) as _DPdf; end; begin ProcName := 'TPdf.CreateControl';TimeTest_ads.Start( ProcName );Try if FIntf = nil then DoCreate; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
function TPdf.GetControlInterface: _DPdf; begin Result := False; ProcName := 'TPdf.GetControlInterface';TimeTest_ads.Start( ProcName );Try CreateControl; Result := FIntf; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
function TPdf.LoadFile(const fileName: WideString): WordBool; begin Result := False; ProcName := 'TPdf.LoadFile';TimeTest_ads.Start( ProcName );Try Result := DefaultInterface.LoadFile(fileName); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setShowToolbar(On_: WordBool); begin ProcName := 'TPdf.setShowToolbar';TimeTest_ads.Start( ProcName );Try DefaultInterface.setShowToolbar(On_); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.gotoFirstPage; begin ProcName := 'TPdf.gotoFirstPage';TimeTest_ads.Start( ProcName );Try DefaultInterface.gotoFirstPage; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.gotoLastPage; begin ProcName := 'TPdf.gotoLastPage';TimeTest_ads.Start( ProcName );Try DefaultInterface.gotoLastPage; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.gotoNextPage; begin ProcName := 'TPdf.gotoNextPage';TimeTest_ads.Start( ProcName );Try DefaultInterface.gotoNextPage; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.gotoPreviousPage; begin ProcName := 'TPdf.gotoPreviousPage';TimeTest_ads.Start( ProcName );Try DefaultInterface.gotoPreviousPage; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setCurrentPage(n: Integer); begin ProcName := 'TPdf.setCurrentPage';TimeTest_ads.Start( ProcName );Try DefaultInterface.setCurrentPage(n); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.goForwardStack; begin ProcName := 'TPdf.goForwardStack';TimeTest_ads.Start( ProcName );Try DefaultInterface.goForwardStack; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.goBackwardStack; begin ProcName := 'TPdf.goBackwardStack';TimeTest_ads.Start( ProcName );Try DefaultInterface.goBackwardStack; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setPageMode(const pageMode: WideString); begin ProcName := 'TPdf.setPageMode';TimeTest_ads.Start( ProcName );Try DefaultInterface.setPageMode(pageMode); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setLayoutMode(const layoutMode: WideString); begin ProcName := 'TPdf.setLayoutMode';TimeTest_ads.Start( ProcName );Try DefaultInterface.setLayoutMode(layoutMode); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setNamedDest(const namedDest: WideString); begin ProcName := 'TPdf.setNamedDest';TimeTest_ads.Start( ProcName );Try DefaultInterface.setNamedDest(namedDest); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.printAll; begin ProcName := 'TPdf.printAll';TimeTest_ads.Start( ProcName );Try DefaultInterface.printAll; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.Print; begin ProcName := 'TPdf.Print';TimeTest_ads.Start( ProcName );Try DefaultInterface.Print; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.printWithDialog; begin ProcName := 'TPdf.printWithDialog';TimeTest_ads.Start( ProcName );Try DefaultInterface.printWithDialog; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setZoom(percent: Single); begin ProcName := 'TPdf.setZoom';TimeTest_ads.Start( ProcName );Try DefaultInterface.setZoom(percent); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setZoomScroll(percent: Single; left: Single; top: Single); begin ProcName := 'TPdf.setZoomScroll';TimeTest_ads.Start( ProcName );Try DefaultInterface.setZoomScroll(percent, left, top); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setView(const viewMode: WideString); begin ProcName := 'TPdf.setView';TimeTest_ads.Start( ProcName );Try DefaultInterface.setView(viewMode); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setViewScroll(const viewMode: WideString; offset: Single); begin ProcName := 'TPdf.setViewScroll';TimeTest_ads.Start( ProcName );Try DefaultInterface.setViewScroll(viewMode, offset); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.AboutBox; begin ProcName := 'TPdf.AboutBox';TimeTest_ads.Start( ProcName );Try DefaultInterface.AboutBox; Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.printPages(from: Integer; to_: Integer); begin ProcName := 'TPdf.printPages';TimeTest_ads.Start( ProcName );Try DefaultInterface.printPages(from, to_); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.printPagesFit(from: Integer; to_: Integer; shrinkToFit: WordBool); begin ProcName := 'TPdf.printPagesFit';TimeTest_ads.Start( ProcName );Try DefaultInterface.printPagesFit(from, to_, shrinkToFit); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setViewRect(left: Single; top: Single; width: Single; height: Single); begin ProcName := 'TPdf.setViewRect';TimeTest_ads.Start( ProcName );Try DefaultInterface.setViewRect(left, top, width, height); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.printAllFit(shrinkToFit: WordBool); begin ProcName := 'TPdf.printAllFit';TimeTest_ads.Start( ProcName );Try DefaultInterface.printAllFit(shrinkToFit); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure TPdf.setShowScrollbars(On_: WordBool); begin ProcName := 'TPdf.setShowScrollbars';TimeTest_ads.Start( ProcName );Try DefaultInterface.setShowScrollbars(On_); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; //Unit Description UnitIndex Master Index
procedure Register; begin ProcName := 'Register';TimeTest_ads.Start( ProcName );Try RegisterComponents(dtlOcxPage, [TPdf]); Except On E : Exception Do RaiseError(UnitName,ProcName,E);End;TimeTest_ads.Stop(); end; end. //