「ドキュメントを追加」アクション
Contents
[
Hide
]
ドキュメントレベルのアクションでは、PDF を開くなど、特定のイベントが発生したときに自動的に実行される動作を定義できます。と PDF コンテンツエディター、これらのイベントには JavaScript コードを添付できます。これは通知、検証ロジック、またはインタラクティブなワークフローに使用できます。
- PDF コンテンツエディターオブジェクトを作成します。
- 入力 PDF をバインドします。
- ドキュメントレベルのアクションを追加します。
- 更新したドキュメントを保存します。
import aspose.pdf.facades as pdf_facades
import aspose.pydrawing as apd
import sys
from os import path
sys.path.append(path.join(path.dirname(__file__), ".."))
from config import set_license, initialize_data_dir
def add_document_action(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
# Add JavaScript action for document open event
content_editor.add_document_additional_action(
content_editor.DOCUMENT_OPEN,
"app.alert('Document opened with PdfContentEditor action');",
)
# Save updated document
content_editor.save(outfile)