애플리케이션 링크 추가

Contents
[ ]

PDF에는 외부 응용 프로그램을 실행하는 링크와 같은 대화형 요소가 포함될 수 있습니다.사용 PDF 콘텐츠 편집기클릭하면 특정 실행 파일이 열리는 페이지의 사각형 영역을 정의할 수 있습니다.

  1. PDF 컨텐트 편집기 인스턴스를 만듭니다.
  2. 입력 PDF 문서를 바인딩합니다.
  3. 클릭 가능한 링크의 사각형 영역을 정의합니다.
  4. 실행할 애플리케이션 경로를 지정합니다.
  5. 링크 색상을 설정합니다.
  6. 업데이트된 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)