アプリケーションリンクを追加
Contents
[
Hide
]
PDF には、外部アプリケーションを起動するリンクなどのインタラクティブな要素を含めることができます。を使用する PDF コンテンツエディターページ上に長方形の領域を定義して、クリックすると特定の実行ファイルを開くことができます。
- PDF コンテンツエディターのインスタンスを作成します。
- 入力 PDF ドキュメントをバインドします。
- クリック可能なリンクの四角形領域を定義します。
- 起動するアプリケーションパスを指定します。
- リンクの色を設定します。
- 更新した PDF ドキュメントを保存します。
import aspose.pdf.facades as pdf_facades
from aspose.pycore import cast, is_assignable
import aspose.pydrawing as apd
import aspose.pdf as ap
import sys
from os import path
sys.path.append(path.join(path.dirname(__file__), ".."))
from config import set_license, initialize_data_dir
def add_application_link(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
# Add application launch link
content_editor.create_application_link(
apd.Rectangle(180, 530, 260, 20),
"notepad.exe",
1,
apd.Color.purple,
)
# Save updated document
content_editor.save(outfile)