TOP > AcroExch.PDAnnot > GetDate [...]
説明
注釈の日付(年月日時分秒+ミリ秒)を得ます。
形式
LPDISPATCH GetDate();
引数
- 無し。
戻り値
- AcroExch.Timeオブジェクトで日付(年月日時分秒+ミリ秒)が返される。
動作するバージョン
Version | Adobe Acrobat | 備考 |
---|---|---|
4 | - | Acrobat 4.0 ※Windows 98SE + Excel 2000 |
5 | - | Acrobat 5.0.5 |
6 | - | Acrobat 6.0.3 Pro |
7 | - | Acrobat 7.0.9 Pro Acrobat 7.1.4 Pro |
8 | OK | Acrobat 8.1.2 Pro |
9 | - | Acrobat 9.3.2 Extended |
10 | - | Acrobat X (10.1.8) Extended |
11 | - | Acrobat XI (11.0.04) Extended |
- OK = 動作する。
- NO = 動作しない。 戻り値が0を返す。
- - = 未確認。
サンプル:ExcelのVBA
説明:PDFファイルの表紙ページのテキスト注釈の日付を全部取得する。
- F8キーでステップ実行しながら動作確認する。
- 事前に参照設定をする。
001 Sub AcroExch_PDAnnot_GetDate()
002
003 Debug.Print "TEST_PDAnnot_GetDate:" & Now
004 Dim objAcroAVDoc As New Acrobat.AcroAVDoc
005 Dim objAcroPDDoc As Acrobat.AcroPDDoc
006 Dim objAcroPDPage As Acrobat.AcroPDPage
007 Dim objAcroPDAnnot As Acrobat.AcroPDAnnot
008 Dim objAcroTime As Acrobat.AcroTime
009 Dim lRet As Long '戻り値
010 Dim lAnnotsCnt As Long '注釈数
011 Dim j As Long '添え字
012 Dim lTextCnt As Long '件数
013
014 lTextCnt = 0
015 'PDFドキュメントを開いて表示する
016 lRet = objAcroAVDoc.Open("E:\Test01.pdf", "")
017 Set objAcroPDDoc = objAcroAVDoc.GetPDDoc()
018 '表紙のページ・オブジェクトを得る
019 Set objAcroPDPage = objAcroPDDoc.AcquirePage(0)
020 'ページに存在する注釈数を得る ★注意①
021 lAnnotsCnt = objAcroPDPage.GetNumAnnots() - 1
022 Debug.Print "全注釈数=" & (lAnnotsCnt + 1)
023 For j = 0 To lAnnotsCnt
024 Set objAcroPDAnnot = objAcroPDPage.GetAnnot(j)
025 If objAcroPDAnnot.GetSubtype = "Text" Then
026 Set objAcroTime = objAcroPDAnnot.GetDate
027 With objAcroTime
028 Debug.Print "日付(" & j & ")=" & _
029 .Year & "/"; _
030 .Month & "/" & _
031 .Date & " " & _
032 .Hour & ":" & _
033 .Minute & ":" & _
034 .Second & ":" & _
035 .millisecond
036 End With
037 lTextCnt = lTextCnt + 1
038 End If
039 Next j
040 Debug.Print "件数=" & lTextCnt
041
042 'PDFファイルを保存しないで閉じる
043 lRet = objAcroAVDoc.Close(1)
044 'オブジェクトを強制解放する
045 Set objAcroAVDoc = Nothing
046 Set objAcroPDAnnot = Nothing
047 Set objAcroPDPage = Nothing
048 Set objAcroPDDoc = Nothing
049
050 End Sub
Highlight:プログラミング言語のソースコードを構文で色分け (GUI編)
実行結果
TEST_PDAnnot_GetDate:2008/08/06 8:53:09
全注釈数=4
日付(0)=2008/8/6 8:52:43:0
日付(2)=2008/8/4 16:29:54:0
件数=2
※下記はPDFビュアーの表紙ページの一部です。

補足
- 「★注意①」の部分はよく動作不良を起こしますが。
今回は他のPDFを閉じたら正常に処理をしました。
他のPDFを表示していると「★注意①」の部分は動作不良を起こす可能性が高いみたいです。
動作確認環境
- WindowsXP Pro(+ SP3) +
Acrobat 8.1.2 Pro + Office 2003 + MicrosoftUpdate
< 戻る >