열린 작업 제거

Contents
[ ]

PDF 문서에는 JavaScript 경고, 탐색 명령 또는 기타 동작과 같이 파일을 열 때 자동으로 실행되는 동작이 포함될 수 있습니다.일부 시나리오에서는 보안, 규정 준수 또는 사용자 경험을 위해 이러한 작업을 제거해야 할 수 있습니다.

PDFContentEditor를 사용하면 문서 열기 작업을 쉽게 제거하고 자동 동작을 실행하지 않고도 PDF가 열리도록 할 수 있습니다.

  1. PDF 컨텐트 편집기 객체를 만듭니다.
  2. 입력 PDF를 바인딩합니다.
  3. 문서 열기 작업을 제거합니다.
  4. 업데이트된 문서를 저장합니다.
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 remove_open_action(infile, outfile):
    # Create PdfContentEditor object
    content_editor = pdf_facades.PdfContentEditor()
    # Bind document to PdfContentEditor
    content_editor.bind_pdf(infile)
    # Remove open action from the document
    content_editor.remove_document_open_action()
    # Save updated document
    content_editor.save(outfile)