북마크 작업 추가

Contents
[ ]

북마크를 사용하면 PDF 문서 내에서 빠르게 탐색할 수 있습니다.사용 PDF 콘텐츠 편집기프로그래밍 방식으로 북마크를 생성하고 페이지 탐색과 같은 작업을 할당할 수 있습니다.굵게 또는 기울임꼴과 같은 색상 및 스타일 옵션을 포함하여 책갈피 모양을 사용자 지정할 수도 있습니다.

  1. PDF 컨텐트 편집기 객체를 만듭니다.
  2. 입력 PDF를 바인딩합니다.
  3. 북마크 속성을 정의합니다.
  4. 북마크 작업을 할당합니다.
  5. 업데이트된 문서를 저장합니다.
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_bookmark_action(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind document to PdfContentEditor
    content_editor.bind_pdf(infile)
    # Add a bookmark action to navigate to page 1
    content_editor.create_bookmarks_action(
        "PdfContentEditor Bookmark",
        apd.Color.blue,
        True,
        False,
        "",
        "GoTo",
        "1",
    )
    # Save updated document
    content_editor.save(outfile)