如何使用ocx?程序自动生成了一个pas,然后怎么办?显示pdf文件内容的问题。

Description of your first forum.

如何使用ocx?程序自动生成了一个pas,然后怎么办?显示pdf文件内容的问题。

帖子xounter » 星期三, 2010年1月13日 08:40


我想在程序中显示pdf内容,但是不知道如何使用?
我搜索了论坛看到说使用import activex,我也已经加入了pdf的activex,程序给我自动生成了一个pas,但是在往后怎么用……我实在是不知道了,能否帮我详细说下?非常感谢!!
 
 
 

如何使用ocx?程序自动生成了一个pas,然后怎么办?显示pdf文件内容的问题。

帖子xounter » 星期三, 2010年1月13日 13:59


有人帮忙看看么?我看着他给的那个pas就是interface,我就想知道如何去写定义和调用……
 
 
 

如何使用ocx?程序自动生成了一个pas,然后怎么办?显示pdf文件内容的问题。

帖子stlont » 星期三, 2010年1月13日 20:01


导入完成会成成一个tlb文件,
当你引用这个控件的时候会在use段看到这个文件,
查看这个文件内容就可以找到可以调用的过程的定义及参数
 
 
 

如何使用ocx?程序自动生成了一个pas,然后怎么办?显示pdf文件内容的问题。

帖子xounter » 星期四, 2010年1月14日 20:48


我也是这么用的
可是我用pda.loadfile('d:\1.pdf').总是报错。应该如何调用?
这是我导入的那个pas文件,谁能帮我看看应该如何使用?我可以单开帖子在给分~非常感谢!!

unit AcroPDFLib_TLB;

// ************************************************************************ //
// 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.                                        
// ************************************************************************ //

// $Rev: 17244 $
// File generated on 2010-1-13 14:58:56 from Type Library described below.

// ************************************************************************  //
// Type Lib: C:\Program Files\Adobe\Acrobat 7.0\ActiveX\AcroPDF.dll (1)
// LIBID: {05BFD3F1-6319-4F30-B752-C7A22889BCC4}
// LCID: 0
// Helpfile:
// HelpString: Adobe Acrobat 7.0 Browser Control Type Library 1.0
// DepndLst:
//   (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// Errors:
//   Hint: Parameter 'On' of IAcroAXDocShim.setShowToolbar changed to 'On_'
//   Hint: Parameter 'to' of IAcroAXDocShim.printPages changed to 'to_'
//   Hint: Parameter 'to' of IAcroAXDocShim.printPagesFit changed to 'to_'
//   Hint: Parameter 'On' of IAcroAXDocShim.setShowScrollbars changed to 'On_'
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
{$ALIGN 4}
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
  AcroPDFLibMajorVersion = 1;
  AcroPDFLibMinorVersion = 0;

  LIBID_AcroPDFLib: TGUID = '{05BFD3F1-6319-4F30-B752-C7A22889BCC4}';

  DIID__IAcroAXDocShimEvents: TGUID = '{E790E1D1-9DE8-4853-8AC6-933D4FD9C927}';
  IID_IAcroAXDocShim: TGUID = '{3B813CE7-7C10-4F84-AD06-9DF76D97A9AA}';
  CLASS_AcroPDF: TGUID = '{CA8A9780-280D-11CF-A24D-444553540000}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  _IAcroAXDocShimEvents = dispinterface;
  IAcroAXDocShim = interface;
  IAcroAXDocShimDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                      
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  AcroPDF = IAcroAXDocShim;


// *********************************************************************//
// DispIntf:  _IAcroAXDocShimEvents
// Flags:     (4096) Dispatchable
// GUID:      {E790E1D1-9DE8-4853-8AC6-933D4FD9C927}
// *********************************************************************//
  _IAcroAXDocShimEvents = dispinterface
    ['{E790E1D1-9DE8-4853-8AC6-933D4FD9C927}']
  end;

// *********************************************************************//
// Interface: IAcroAXDocShim
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {3B813CE7-7C10-4F84-AD06-9DF76D97A9AA}
// *********************************************************************//
  IAcroAXDocShim = interface(IDispatch)
    ['{3B813CE7-7C10-4F84-AD06-9DF76D97A9AA}']
    function Get_src: WideString; safecall;
    procedure Set_src(const pVal: WideString); safecall;
    function LoadFile(const fileName: WideString): WordBool; safecall;
    procedure setShowToolbar(On_: WordBool); safecall;
    procedure gotoFirstPage; safecall;
    procedure gotoLastPage; safecall;
    procedure gotoNextPage; safecall;
    procedure gotoPreviousPage; safecall;
    procedure setCurrentPage(n: Integer); safecall;
    procedure goForwardStack; safecall;
    procedure goBackwardStack; safecall;
    procedure setPageMode(const pageMode: WideString); safecall;
    procedure setLayoutMode(const layoutMode: WideString); safecall;
    procedure setNamedDest(const namedDest: WideString); safecall;
    procedure Print; safecall;
    procedure printWithDialog; safecall;
    procedure setZoom(percent: Single); safecall;
    procedure setZoomScroll(percent: Single; left: Single; top: Single); safecall;
    procedure setView(const viewMode: WideString); safecall;
    procedure setViewScroll(const viewMode: WideString; offset: Single); safecall;
    procedure setViewRect(left: Single; top: Single; width: Single; height: Single); safecall;
    procedure printPages(from: Integer; to_: Integer); safecall;
    procedure printPagesFit(from: Integer; to_: Integer; shrinkToFit: WordBool); safecall;
    procedure printAll; safecall;
    procedure printAllFit(shrinkToFit: WordBool); safecall;
    procedure setShowScrollbars(On_: WordBool); safecall;
    function GetVersions: OleVariant; safecall;
    procedure setCurrentHightlight(a: Integer; b: Integer; c: Integer; d: Integer); safecall;
    procedure setCurrentHighlight(a: Integer; b: Integer; c: Integer; d: Integer); safecall;
    property src: WideString read Get_src write Set_src;
  end;

// *********************************************************************//
// DispIntf:  IAcroAXDocShimDisp
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {3B813CE7-7C10-4F84-AD06-9DF76D97A9AA}
// *********************************************************************//
  IAcroAXDocShimDisp = dispinterface
    ['{3B813CE7-7C10-4F84-AD06-9DF76D97A9AA}']
    property src: WideString dispid 1;
    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 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 setViewRect(left: Single; top: Single; width: Single; height: Single); dispid 20;
    procedure printPages(from: Integer; to_: Integer); dispid 21;
    procedure printPagesFit(from: Integer; to_: Integer; shrinkToFit: WordBool); dispid 22;
    procedure printAll; dispid 23;
    procedure printAllFit(shrinkToFit: WordBool); dispid 24;
    procedure setShowScrollbars(On_: WordBool); dispid 25;
    function GetVersions: OleVariant; dispid 26;
    procedure setCurrentHightlight(a: Integer; b: Integer; c: Integer; d: Integer); dispid 27;
    procedure setCurrentHighlight(a: Integer; b: Integer; c: Integer; d: Integer); dispid 28;
  end;

implementation

uses ComObj;

end.