カーブ注釈を追加
Contents
[
Hide
]
カーブ注釈は、PDF内の不規則なパスや形状を強調表示したり、視覚的に強調したり、重要な領域をマークしたりするために使用されます。を使用する PDF コンテンツエディター、頂点のシーケンス、境界線のスタイル、可視性、注釈長方形、説明文を指定して曲線を描くことができます。
- PDF コンテンツエディターオブジェクトを作成します。
- 入力 PDF をバインドします。
- カーブのプロパティを設定します。
- カーブアノテーションを描画します。
- 更新したドキュメントを保存します。
import aspose.pdf as ap
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_curve_annotation(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind input PDF file
content_editor.bind_pdf(infile)
line_info = pdf_facades.LineInfo()
line_info.border_style = 1 # 1 - Dashed
line_info.vertice_coordinate = [120, 520, 160, 560, 220, 540, 280, 580]
line_info.visibility = True
content_editor.draw_curve(
line_info,
1,
apd.Rectangle(110, 510, 220, 100),
"This is curve annotation",
)
# Save output PDF file
content_editor.save(outfile)