delphi  如何获取pdf文档的属性 ,比如作者 ,创建时间 ,标题,主题等信息呢?

解决方案 »

  1.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, Comobj;
    const 
     wdPropertyTitle = $00000001;
     wdPropertySubject = $00000002;
     wdPropertyAuthor = $00000003;
     wdPropertyKeywords = $00000004;
     wdPropertyComments = $00000005;
     wdPropertyTemplate = $00000006;
     wdPropertyLastAuthor = $00000007;
     wdPropertyRevision = $00000008;
     wdPropertyAppName = $00000009;
     wdPropertyTimeLastPrinted = $0000000A;
     wdPropertyTimeCreated = $0000000B;
     wdPropertyTimeLastSaved = $0000000C;
     wdPropertyVBATotalEdit = $0000000D;
     wdPropertyPages = $0000000E;
     wdPropertyWords = $0000000F;
     wdPropertyCharacters = $00000010;
     wdPropertySecurity = $00000011;
     wdPropertyCategory = $00000012;
     wdPropertyFormat = $00000013;
     wdPropertyManager = $00000014;
     wdPropertyCompany = $00000015;
     wdPropertyBytes = $00000016;
     wdPropertyLines = $00000017;
     wdPropertyParas = $00000018;
     wdPropertySlides = $00000019;
     wdPropertyNotes = $0000001A;
     wdPropertyHiddenSlides = $0000001B;
     wdPropertyMMClips = $0000001C;
     wdPropertyHyperlinkBase = $0000001D;
     wdPropertyCharsWSpaces = $0000001E;
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        Memo1: TMemo;
        OpenDialog1: TOpenDialog;    procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
    var
      vWord, vDoc, docBuiltInProps, typeDocBuiltInProps: Variant;
    begin
    if not OpenDialog1.Execute then Exit;
      vWord := CreateOleObject('Word.Application'); //创建Word线程 try //打开要操作的文件
      vDoc := vWord.Documents.Open(OpenDialog1.FileName);
      docBuiltInProps := vDoc.BuiltInDocumentProperties;
      memo1.Lines.Add(format('%s : %s', ['页数', vDoc.BuiltInDocumentProperties[wdPropertyPages].Value]));
      memo1.Lines.Add(format('%s : %s', ['作者', vDoc.BuiltInDocumentProperties[wdPropertyAuthor].Value]));
      memo1.Lines.Add(format('%s : %s', ['标题', vDoc.BuiltInDocumentProperties[wdPropertyTitle].Value]));
      vDoc.Close(True); //关闭文并保存
      vWord.Quit(False); //退出Word endend;procedure TForm1.Button2Click(Sender: TObject);
    begin
    RenameFile('c:\1.doc','c:\2.doc');
    end;end.手头上没有带作者等信息的PDF文档,试试这个
      

  2.   

    这个是word的吧!不知道行不行!先试试!等高人!
      

  3.   

    楼上的!这个读office文件更好!不过也有缺点! 就是移植性不好!http://blog.csdn.net/flyforlove/article/details/310964
      

  4.   

    我在什么当网上看的,标题说可以读WORD和PDF,具体没试。