사운드 주석 추가
Contents
[
Hide
]
PDF의 사운드 주석을 사용하면 음성 메모, 음악 또는 사운드 효과와 같은 오디오 콘텐츠를 문서에 추가할 수 있습니다.사용 PDF 콘텐츠 편집기활성화 시 지정된 오디오 파일을 재생하는 페이지에서 클릭 가능한 작은 사각형을 정의할 수 있습니다.
- PDF 컨텐트 편집기 인스턴스를 만듭니다.
- 입력 PDF 문서를 바인딩합니다.
- 사운드 주석의 직사각형을 정의합니다.
- 오디오 파일, 주석 이름, 페이지 번호 및 샘플링 속도를 지정합니다.
- 업데이트된 PDF 문서를 저장합니다.
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_sound_annotation(infile, sound_file, outfile):
# Create PdfContentEditor object
content_editor = pdf_facades.PdfContentEditor()
# Bind document to PdfContentEditor
content_editor.bind_pdf(infile)
# Add sound annotation to page 1
content_editor.create_sound(
apd.Rectangle(80, 450, 30, 30), sound_file, "Speaker", 1, "8000"
)
# Save updated document
content_editor.save(outfile)