顯示具有 PDF 標籤的文章。 顯示所有文章
顯示具有 PDF 標籤的文章。 顯示所有文章

2011年5月19日 星期四

Adobe Acrobat Javascript Example Codes

用 JavaScript 的方式語法較簡單。

修改 UI

利用 app。如 app.addMenuItem

重要的參數包括:

  1. cName: The language-independent name of the menu item. This name can be used by other methods (for example, hideMenuItem) to access the menu item.
  2. cUser: (optional) The user string (language-dependent name) to display as the menu item name. If cUser is not specified, cName is used.
  3. cParent: The name of the parent menu item. Its submenu will have the new menu item added to it. If cParent has no submenu, an exception is thrown.
  4. nPos: (optional) The position within the submenu to locate the new menu item. The default behavior is to append to the end of the submenu. Specifying nPos as 0 adds the menu to the top of the submenu.
  5. cExec: An expression string to evaluate when the menu item is selected by the user.

quads 應用

quads 回傳的內容為 4 組 (x, y) 的座標內容。舉例來說,
quads: [[43],[756],[78],[756],[43],[745],[78],[745]],
代表的是如下圖的座標:

image

的座標。

下面是動態建立一個 quads 與 Annotation 的範例:

var quads1=this.getPageNthWordQuads(p, startIndex);
var quads2=this.getPageNthWordQuads(p, endIndex);
var quads=[[quads1[0][0], quads1[0][1], quads2[0][2], quads2[0][3], quads1[0][4], quads1[0][5], quads2[0][6], quads2[0][7]]];
var annot = this.addAnnot({page: p, type: "Highlight",
                                      quads: quads, author: annotator
                                     });

上面的程式碼要注意換行的情況。

Resources

2011年4月26日 星期二

如何 Debug PDF Plug-in

Project property page->Configuration Properties->Debugging->Command

中設定 Acrobat/Reader 的執行檔案路徑,再加上中斷點即可。

PS: 前提是編譯好的檔案要複製到 plug_ins 目錄內。

2011年4月22日 星期五

PDF prefix registration

Adobe 利用 4 個字元長度的 prefix 來區隔不同的 developer。

Adobe 預設使用 ADBE 或 Acro,一般開發者可以在 PDF prefix registration 中註冊自己的 prefix。藉由註冊自己的 prefix 可以確保跟其它開發者的元件區隔。

2011年4月20日 星期三

PDF library

Haru Free PDF Library

Hary free PDF Library 可用來建立 PDF 的免費 library。現階段不支援從既存的 PDF 檔案中載入的功能。

Acrobat SDKs

SDK 現在為免費提供。使用該 SDK 可建立軟體與增效模組,與 Adobe Acrobat 和 Adobe Reader 軟體互動並進行各項自訂。

References