四角形の注釈を追加
Contents
[
Hide
]
四角形の注釈は通常、関心のある領域を強調したり、重要なセクションをマークしたり、PDF文書に視覚的な手がかりを与えたりする場合に使用されます。使用方法 PDF コンテンツエディター、境界長方形、コンテンツテキスト、境界線の色、塗りつぶしオプション、ページ番号、境界線の幅を指定することで、正方形 (または円形) の注釈を作成できます。
- PDF コンテンツエディターオブジェクトを作成します。
- 入力 PDF をバインドします。
- Square アノテーションを定義します。
- Square アノテーションを追加します。
- 更新したドキュメントを保存します。
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_square_annotation(infile, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind input PDF file
content_editor.bind_pdf(infile)
# Create SquareAnnotation object
rect = apd.Rectangle(100, 300, 200, 400)
contents = "This is square annotation"
content_editor.create_square_circle(rect, contents, apd.Color.blue, True, 1, 3)
# Save output PDF file
content_editor.save(outfile)