Skip to content

Julia API 레퍼런스

PDF Oxide는 pdf_oxide C ABI 위에 ccall로 직접 얹은 관용적인 Julia 바인딩(PdfOxide.jl)을 제공합니다 — 별도의 셰임(shim) 크레이트는 없습니다. 네이티브 핸들은 파이널라이저를 가진 mutable struct로 감싸져 있고, C 문자열과 버퍼는 Julia로 복사된 뒤 자동으로 해제되며, 성공이 아닌 C-ABI 상태 코드는 모두 PdfOxideError를 던집니다. 페이지 인덱스는 0부터 시작합니다.

using Pkg
Pkg.add("PdfOxide")

네이티브 libpdf_oxide cdylib은 런타임에 로드되며 PDF_OXIDE_LIB_PATHPDF_OXIDE_LIB_DIR../target/releasetarget/release → 시스템 로더 순서로 탐색해 찾습니다. 바인딩에 필요한 feature 세트로 빌드하세요:

cargo build --release --lib --features ocr,rendering,signatures,barcodes,tsa-client,system-fonts
using PdfOxide

pdf = from_markdown("# Hello\n\nbody\n")
doc = open_from_bytes(to_bytes(pdf))
page_count(doc)
extract_text(doc, 0)        # 0-based page index
to_markdown_all(doc)
close!(doc)

Rust API는 Rust API 레퍼런스를, Python API는 Python API 레퍼런스를 참고하세요. 타입에 대한 자세한 내용은 타입 & 열거형을 참고하세요.

대부분의 핸들 타입(PdfDocument, Pdf, DocumentEditor, DocumentBuilder, RenderedImage, Certificate, SignatureInfo, Timestamp, TsaClient, Dss, 검증 결과, Barcode, OcrEngine, Renderer, ElementList, EmbeddedFont, PageBuilder)는 네이티브 메모리를 소유합니다. close!(x)로 즉시 해제하세요 — 이 함수는 멱등(idempotent)이며 파이널라이저에서도 실행됩니다.


PdfDocument

기존 PDF를 열고, 추출하고, 검색하고, 렌더링하고, 검증하고, 살펴보는 읽기 전용 핸들입니다.

열기

open_document(path::AbstractString; password::Union{Nothing,AbstractString} = nothing) -> PdfDocument
open_from_bytes(data::AbstractVector{UInt8}) -> PdfDocument
open_with_password(path::AbstractString, password::AbstractString) -> PdfDocument
함수 설명
open_document(path; password=nothing) 파일 시스템 경로에서 PDF를 엽니다(비밀번호로 보호된 경우 선택적으로 지정).
open_from_bytes(data) 메모리상의 바이트 벡터에서 PDF를 엽니다.
open_with_password(path, password) 디스크에 있는 암호화된 PDF를 비밀번호로 엽니다.

문서 정보

함수 반환값 설명
page_count(d) Int 페이지 수.
version(d) PdfVersion PDF 버전(major/minor).
is_encrypted(d) Bool 문서가 암호화되어 있는지 여부.
has_structure_tree(d) Bool 문서가 구조 트리를 가진 Tagged PDF인지 여부.
has_xfa(d) Bool 문서가 XFA 폼을 포함하는지 여부.
authenticate(d, password) Bool 암호화된 문서의 비밀번호를 인증합니다(틀린 비밀번호는 오류가 아닌 false를 반환).

문서 전체 변환

함수 반환값 설명
to_markdown_all(d) String 문서 전체의 Markdown.
to_html_all(d) String 문서 전체의 HTML.
to_plain_text_all(d) String 문서 전체의 일반 텍스트.
extract_all_text(d) String 문서 전체의 자동 텍스트 추출.
classify_document(d) String 문서 전체를 분류합니다; 분류기의 JSON 문자열을 반환합니다.

페이지별 텍스트 추출

extract_text(d::PdfDocument, page::Integer) -> String
to_plain_text(d::PdfDocument, page::Integer) -> String
to_markdown(d::PdfDocument, page::Integer) -> String
to_html(d::PdfDocument, page::Integer) -> String
extract_structured_json(d::PdfDocument, page::Integer) -> String
함수 설명
extract_text(d, page) 0부터 시작하는 페이지에서 일반 텍스트를 추출합니다.
to_plain_text(d, page) 페이지를 레이아웃을 반영한 일반 텍스트로 렌더링합니다.
to_markdown(d, page) 페이지를 Markdown으로 렌더링합니다.
to_html(d, page) 페이지를 HTML로 렌더링합니다.
extract_structured_json(d, page) 페이지의 구조화된 문서 JSON 모델을 추출합니다.
extract_text_auto(d, page) 페이지에 가장 적합한 텍스트 추출 방식을 자동으로 선택합니다.
extract_page_auto(d, page, options="{}") JSON 옵션 문자열을 사용한 자동 페이지 추출.
classify_page(d, page) 페이지를 분류합니다; 분류기의 JSON 문자열을 반환합니다.

구조화된 요소 추출

extract_chars(d::PdfDocument, page::Integer)      -> Vector{Char}
extract_words(d::PdfDocument, page::Integer)      -> Vector{Word}
extract_text_lines(d::PdfDocument, page::Integer) -> Vector{TextLine}
extract_tables(d::PdfDocument, page::Integer)     -> Vector{Table}
embedded_fonts(d::PdfDocument, page::Integer)     -> Vector{Font}
embedded_images(d::PdfDocument, page::Integer)    -> Vector{Image}
page_annotations(d::PdfDocument, page::Integer)   -> Vector{Annotation}
extract_paths(d::PdfDocument, page::Integer)      -> Vector{Path}
함수 설명
extract_chars(d, page) 페이지에서 글리프를 Vector{Char}로 추출합니다.
extract_words(d, page) 페이지에서 단어를 Vector{Word}로 추출합니다.
extract_text_lines(d, page) 텍스트 줄을 Vector{TextLine}으로 추출합니다.
extract_tables(d, page) 표를 Vector{Table}로 추출합니다.
embedded_fonts(d, page) 임베드된 글꼴을 Vector{Font}로 반환합니다.
embedded_images(d, page) 임베드된 이미지를 Vector{Image}로 반환합니다.
page_annotations(d, page) 주석을 Vector{Annotation}으로 반환합니다.
extract_paths(d, page) 벡터 경로를 Vector{Path}로 반환합니다.

영역 제한 추출

extract_text_in_rect(d::PdfDocument, page::Integer, x, y, w, h)   -> String
extract_words_in_rect(d::PdfDocument, page::Integer, x, y, w, h)  -> Vector{Word}
extract_lines_in_rect(d::PdfDocument, page::Integer, x, y, w, h)  -> Vector{TextLine}
extract_tables_in_rect(d::PdfDocument, page::Integer, x, y, w, h) -> Vector{Table}
extract_images_in_rect(d::PdfDocument, page::Integer, x, y, w, h) -> Vector{Image}

각 함수는 0부터 시작하는 페이지에서 PDF 사용자 공간 포인트 단위의 직사각형 (x, y, w, h)로 추출 범위를 제한합니다.

검색

search(d::PdfDocument, page::Integer, term::AbstractString, caseSensitive::Bool) -> Vector{SearchResult}
search_all(d::PdfDocument, term::AbstractString, caseSensitive::Bool)             -> Vector{SearchResult}
search_results_to_json(d::PdfDocument, term::AbstractString, caseSensitive::Bool) -> String
함수 설명
search(d, page, term, caseSensitive) 단일 페이지에서 term을 검색합니다.
search_all(d, term, caseSensitive) 문서 전체에서 term을 검색합니다.
search_results_to_json(d, term, caseSensitive) 문서 전체 검색 결과를 JSON으로 직렬화합니다.

페이지 기하 정보

함수 반환값 설명
page_get_width(d, page) Float64 페이지 너비(PDF 포인트).
page_get_height(d, page) Float64 페이지 높이(PDF 포인트).
page_get_rotation(d, page) Int 페이지의 절대 회전 각도(도).
page(d, index) PdfPage 문서에 대한 0부터 시작하는 페이지 뷰(PdfPage 참고).

문서 구조 & 메타데이터

함수 반환값 설명
get_outline(d) String 북마크 / 목차(JSON).
get_page_labels(d) String 페이지 라벨 범위(JSON).
get_xmp_metadata(d) String XMP 메타데이터(JSON).
get_source_bytes(d) Vector{UInt8} 문서의 원본 소스 바이트.
plan_split_by_bookmarks(d, options="{}") String 북마크 기준 분할 작업을 계획합니다(JSON).

주석 검사

annotations_to_json(d::PdfDocument, page::Integer) -> String
annotation_get_color(d::PdfDocument, page::Integer, index::Integer) -> UInt32
annotation_creation_date(d::PdfDocument, page::Integer, index::Integer) -> String
annotation_modification_date(d::PdfDocument, page::Integer, index::Integer) -> String
함수 반환값 설명
annotations_to_json(d, page) String 페이지의 모든 주석을 JSON으로 반환합니다.
annotation_get_color(d, page, index) UInt32 주석의 32비트 패킹된 RGBA 색상.
annotation_creation_date(d, page, index) String 주석 생성 일자.
annotation_modification_date(d, page, index) String 주석 수정 일자.
annotation_is_hidden(d, page, index) Bool 주석이 숨김 상태인지 여부.
annotation_is_marked_deleted(d, page, index) Bool 주석이 삭제 표시되었는지 여부.
annotation_is_printable(d, page, index) Bool 주석이 인쇄 가능한지 여부.
annotation_is_read_only(d, page, index) Bool 주석이 읽기 전용인지 여부.
link_annotation_uri(d, page, index) String Link 주석의 URI.
text_annotation_icon_name(d, page, index) String Text(스티커 노트) 주석의 아이콘 이름.
highlight_quad_points_count(d, page, index) Int Highlight 주석의 쿼드 포인트 개수.
highlight_quad_point(d, page, index, quad_index) NTuple{8,Float64} quad_index번째 쿼드(실수 8개).

글꼴 & 요소 JSON 헬퍼

함수 반환값 설명
fonts_to_json(d, page) String 페이지에 임베드된 글꼴을 JSON으로 반환합니다.
font_size(d, page, index) Float64 index번째 임베드 글꼴의 크기.
page_get_elements(d, page) ElementList 페이지 레이아웃 영역 요소를 ElementList로 반환합니다.

폼 필드

get_form_fields(d::PdfDocument) -> Vector{FormField}
form_field_count(d::PdfDocument) -> Int
export_form_data_to_bytes(d::PdfDocument, format_type::Integer) -> Vector{UInt8}
import_form_data(d::PdfDocument, path::AbstractString) -> Int
form_import_from_file(d::PdfDocument, filename::AbstractString) -> Bool
함수 설명
get_form_fields(d) 모든 AcroForm 필드를 Vector{FormField}로 반환합니다.
form_field_count(d) 필드 개수를 간단히 반환합니다.
export_form_data_to_bytes(d, format_type) 폼 데이터를 내보냅니다(format_type으로 FDF/XFDF 선택).
import_form_data(d, path) 파일에서 폼 데이터를 가져옵니다; C 상태 코드를 반환합니다.
form_import_from_file(d, filename) 폼 데이터를 가져옵니다; 성공 시 true를 반환합니다.

OCR

page_needs_ocr(d::PdfDocument, page::Integer) -> Bool
ocr_extract_text(d::PdfDocument, page::Integer, engine::Union{Nothing,OcrEngine} = nothing) -> String
함수 설명
page_needs_ocr(d, page) 페이지가 스캔/하이브리드 형태로 OCR이 필요한지 여부.
ocr_extract_text(d, page, engine=nothing) OCR로 텍스트를 추출합니다(nothing이면 네이티브 추출로만 폴백). OcrEngine 참고.

전자서명(문서 수준)

sign(d::PdfDocument, cert::Certificate; reason::AbstractString = "", location::AbstractString = "") -> Int
get_signature_count(d::PdfDocument) -> Int
get_signature(d::PdfDocument, index::Integer) -> SignatureInfo
verify_all_signatures(d::PdfDocument) -> Int
has_timestamp(d::PdfDocument) -> Int
document_get_dss(d::PdfDocument) -> Union{Dss,Nothing}
함수 설명
sign(d, cert; reason, location) cert로 문서에 서명합니다; 상태 코드를 반환합니다.
get_signature_count(d) 문서에 포함된 서명 수.
get_signature(d, index) index번째 서명을 SignatureInfo로 반환합니다.
verify_all_signatures(d) 모든 서명을 검증합니다; 상태 코드를 반환합니다.
has_timestamp(d) 문서가 문서 수준 타임스탬프를 가지는지 여부.
document_get_dss(d) 문서의 /DSSDss로 읽습니다; 없으면 nothing을 반환합니다.

검증 & 변환

validate_pdf_a(d::PdfDocument, level::Integer) -> PdfAResults
validate_pdf_ua(d::PdfDocument, level::Integer) -> UaResults
validate_pdf_x(d::PdfDocument, level::Integer) -> PdfXResults
document_convert_to_pdf_a(d::PdfDocument, level::Integer) -> Bool

validatePdfA / validatePdfUa / validatePdfX는 세 검증기의 camelCase 별칭입니다. 검증 결과를 참고하세요.

오피스 변환

to_docx(d::PdfDocument) -> Vector{UInt8}
to_pptx(d::PdfDocument) -> Vector{UInt8}
to_xlsx(d::PdfDocument) -> Vector{UInt8}

PDF를 DOCX / PPTX / XLSX 바이트 버퍼로 다시 변환합니다. 오피스 파일을 PDF로 여는 작업은 open_from_docx_bytes / open_from_pptx_bytes / open_from_xlsx_bytes로 수행합니다(오피스 입력 참고).

라이프사이클

함수 설명
close!(d) 네이티브 핸들을 즉시 해제합니다(멱등이며 파이널라이저에서도 실행됩니다).

PdfPage

page(doc, index)가 반환하는 경량의 0부터 시작하는 페이지 뷰입니다. 메서드는 모두 부모 문서로 위임됩니다.

p = page(doc, 0)
text(p)                       # -> String
markdown(p)                   # -> String
extract_words(p)              # -> Vector{Word}
search(p, "term", false)      # -> Vector{SearchResult}
render_page(p)                # -> RenderedImage
메서드 반환값 설명
text(p) String 페이지의 일반 텍스트.
markdown(p) String 페이지의 Markdown.
html(p) String 페이지의 HTML.
plain_text(p) String 레이아웃을 반영한 일반 텍스트.
extract_chars(p) Vector{Char} 글리프.
extract_words(p) Vector{Word} 단어.
extract_text_lines(p) Vector{TextLine} 텍스트 줄.
extract_tables(p) Vector{Table} 표.
embedded_fonts(p) Vector{Font} 임베드된 글꼴.
embedded_images(p) Vector{Image} 임베드된 이미지.
page_annotations(p) Vector{Annotation} 주석.
extract_paths(p) Vector{Path} 벡터 경로.
search(p, term, caseSensitive) Vector{SearchResult} 페이지를 검색합니다.
render_page(p, format=0) RenderedImage 페이지를 렌더링합니다(0=PNG).
render_page_zoom(p, zoom, format=0) RenderedImage 확대 배율로 렌더링합니다.
render_page_thumbnail(p, size, format=0) RenderedImage size 픽셀에 맞춘 썸네일을 렌더링합니다.

렌더링

PdfDocument 페이지를 이미지로 렌더링합니다. format: 0=PNG(기본값), 1=JPEG. 좌표는 PDF 사용자 공간 포인트 단위입니다.

render_page(d::PdfDocument, pageIndex::Integer, format::Integer = 0) -> RenderedImage
render_page_zoom(d::PdfDocument, pageIndex::Integer, zoom::Real, format::Integer = 0) -> RenderedImage
render_page_thumbnail(d::PdfDocument, pageIndex::Integer, size::Integer, format::Integer = 0) -> RenderedImage
render_page_region(d::PdfDocument, page::Integer, crop_x, crop_y, crop_width, crop_height, format::Integer = 0) -> RenderedImage
render_page_fit(d::PdfDocument, page::Integer, w::Integer, h::Integer, format::Integer = 0) -> RenderedImage
render_page_raw(d::PdfDocument, page::Integer, dpi::Integer) -> Tuple{RenderedImage,Int,Int}
render_page_with_options(d::PdfDocument, page::Integer, dpi, format, bg_r, bg_g, bg_b, bg_a, transparent_background, render_annotations, jpeg_quality) -> RenderedImage
render_page_with_options_ex(d::PdfDocument, page::Integer, dpi, format, bg_r, bg_g, bg_b, bg_a, transparent_background, render_annotations, jpeg_quality, excluded_layers::AbstractVector{<:AbstractString} = String[]) -> RenderedImage
함수 설명
render_page(d, page, format=0) 페이지를 렌더링합니다(0=PNG).
render_page_zoom(d, page, zoom, format=0) 확대 배율로 렌더링합니다.
render_page_thumbnail(d, page, size, format=0) size 픽셀에 맞춘 썸네일을 렌더링합니다.
render_page_region(d, page, x, y, w, h, format=0) 직사각형 크롭(사용자 공간 포인트)을 렌더링합니다.
render_page_fit(d, page, w, h, format=0) 종횡비를 유지하며 w×h 픽셀 안에 맞춰 렌더링합니다.
render_page_raw(d, page, dpi) 프리멀티플라이된 원시 RGBA8888 버퍼로 렌더링합니다; (image, width, height)를 반환합니다.
render_page_with_options(d, page, dpi, format, bg_r, bg_g, bg_b, bg_a, transparent_background, render_annotations, jpeg_quality) RenderOptions 전체 옵션으로 렌더링합니다(배경 채널 0–1; 플래그는 0/1).
render_page_with_options_ex(...; excluded_layers) 위와 동일하지만 OCG 레이어 필터링이 추가됩니다 — 지정한 /Name 레이어를 숨깁니다.
estimate_render_time(d, page) 페이지의 예상 렌더링 시간(ms)을 추정합니다.

renderPage / renderPageZoom / renderPageThumbnailrender_page / render_page_zoom / render_page_thumbnail의 camelCase 별칭입니다.

Renderer

재사용 가능한 렌더러 핸들입니다.

create_renderer(dpi::Integer = 150, format::Integer = 0, quality::Integer = 90, anti_alias::Bool = true) -> Renderer
close!(r::Renderer)

RenderedImage

렌더링 호출의 결과입니다. 필드: width::Int, height::Int, data::Vector{UInt8}(인코딩된 바이트, 또는 render_page_raw의 경우 원시 RGBA).

save(img::RenderedImage, path::AbstractString)   # write to disk (format inferred)
close!(img::RenderedImage)

DocumentEditor

기존 PDF를 수정하고 다시 저장하는 편집용 핸들입니다.

열기 & 소스

open_editor(path::AbstractString) -> DocumentEditor
open_editor_from_bytes(data::AbstractVector{UInt8}) -> DocumentEditor
함수 반환값 설명
is_modified(e) Bool 에디터에 저장되지 않은 변경 사항이 있는지 여부.
get_source_path(e) String 에디터를 연 소스 경로.
page_count(e) Int 페이지 수.
version(e) PdfVersion PDF 버전.

정보 / 메타데이터

함수 설명
get_producer(e) /Info.Producer의 생산자 정보.
set_producer(e, value) /Info.Producer를 설정합니다.
get_creation_date(e) /Info.CreationDate의 생성 일자(원시 PDF 날짜 문자열).
set_creation_date(e, date_str) /Info.CreationDate를 설정합니다(원시 PDF 날짜 문자열).

저장

save(e::DocumentEditor, path::AbstractString)
save_to_bytes(e::DocumentEditor) -> Vector{UInt8}
save_to_bytes_with_options(e::DocumentEditor, compress::Bool, garbage_collect::Bool, linearize::Bool) -> Vector{UInt8}
extract_pages_to_bytes(e::DocumentEditor, pages::AbstractVector{<:Integer}) -> Vector{UInt8}
save_encrypted(e::DocumentEditor, path::AbstractString, user_password::AbstractString, owner_password::AbstractString)
save_encrypted_to_bytes(e::DocumentEditor, user_password::AbstractString, owner_password::AbstractString) -> Vector{UInt8}
convert_to_pdf_a(e::DocumentEditor, level::Integer)
함수 설명
save(e, path) 편집된 문서를 경로에 저장합니다.
save_to_bytes(e) 편집된 문서를 바이트로 직렬화합니다.
save_to_bytes_with_options(e, compress, garbage_collect, linearize) 압축 / GC / 선형화 옵션과 함께 직렬화합니다.
extract_pages_to_bytes(e, pages) 일부 페이지를 새로운 메모리상의 PDF로 추출합니다.
save_encrypted(e, path, user_pw, owner_pw) AES-256 암호화와 함께 경로에 저장합니다.
save_encrypted_to_bytes(e, user_pw, owner_pw) AES-256 암호화와 함께 바이트로 저장합니다.
convert_to_pdf_a(e, level) 제자리에서 PDF/A로 변환합니다(level: 0=A1b…7=A3u).

병합 & 첨부 파일

함수 설명
merge_from(e, source_path) 디스크의 PDF에서 페이지를 병합합니다.
merge_from_bytes(e, data) 메모리상의 PDF 버퍼에서 페이지를 병합합니다.
embed_file(e, name, data) 파일 첨부를 임베드합니다(name, data 바이트).

페이지 작업

rotate_all_pages(e::DocumentEditor, degrees::Integer)
rotate_page_by(e::DocumentEditor, page::Integer, degrees::Integer)
get_page_rotation(e::DocumentEditor, page::Integer) -> Int
set_page_rotation(e::DocumentEditor, page::Integer, degrees::Integer)
delete_page(e::DocumentEditor, page::Integer)
move_page(e::DocumentEditor, from::Integer, to::Integer)
함수 설명
rotate_all_pages(e, degrees) 모든 페이지를 회전합니다(상대값).
rotate_page_by(e, page, degrees) 페이지를 누적해서 회전합니다.
get_page_rotation(e, page) 페이지의 절대 회전 각도.
set_page_rotation(e, page, degrees) 페이지의 절대 회전 각도를 설정합니다.
delete_page(e, page) 페이지를 삭제합니다.
move_page(e, from, to) 페이지를 한 인덱스에서 다른 인덱스로 이동합니다.

페이지 박스 & 크롭

get_page_media_box(e::DocumentEditor, page::Integer) -> NTuple{4,Float64}
get_page_crop_box(e::DocumentEditor, page::Integer) -> NTuple{4,Float64}
set_page_media_box(e::DocumentEditor, page::Integer, x, y, w, h)
set_page_crop_box(e::DocumentEditor, page::Integer, x, y, w, h)
crop_margins(e::DocumentEditor, left::Real, right::Real, top::Real, bottom::Real)
함수 설명
get_page_media_box(e, page) 페이지의 MediaBox를 가져옵니다.
get_page_crop_box(e, page) 페이지의 CropBox를 가져옵니다.
set_page_media_box(e, page, x, y, w, h) 페이지의 MediaBox를 설정합니다.
set_page_crop_box(e, page, x, y, w, h) 페이지의 CropBox를 설정합니다.
crop_margins(e, left, right, top, bottom) 여백 기준으로 모든 페이지를 크롭합니다(사용자 공간).

지우기 / 화이트아웃

erase_region(e::DocumentEditor, page::Integer, x, y, w, h)
erase_regions(e::DocumentEditor, page::Integer, rects::AbstractVector{<:NTuple{4,<:Real}})
clear_erase_regions(e::DocumentEditor, page::Integer)
함수 설명
erase_region(e, page, x, y, w, h) 직사각형 영역 하나를 지웁니다.
erase_regions(e, page, rects) 여러 영역을 지웁니다(rects(x, y, w, h) 튜플의 벡터).
clear_erase_regions(e, page) 페이지에 대기 중인 모든 지우기 영역 항목을 초기화합니다.

헤더 / 푸터 / 아티팩트 제거

erase_header(d::PdfDocument, page::Integer)
erase_footer(d::PdfDocument, page::Integer)
erase_artifacts(d::PdfDocument, page::Integer)
remove_headers(d::PdfDocument, threshold::Real = 0.5)
remove_footers(d::PdfDocument, threshold::Real = 0.5)
remove_artifacts(d::PdfDocument, threshold::Real = 0.5)
함수 설명
erase_header(d, page) / erase_footer(d, page) / erase_artifacts(d, page) 페이지에서 감지된 헤더 / 푸터 / 아티팩트를 지웁니다.
remove_headers(d, threshold=0.5) / remove_footers(...) / remove_artifacts(...) 빈도 임계값 이상으로 반복되는 헤더 / 푸터 / 아티팩트를 문서 전체에서 제거합니다.

주석 플래튼

flatten_annotations(e::DocumentEditor, page::Integer)
flatten_all_annotations(e::DocumentEditor)
is_page_marked_for_flatten(e::DocumentEditor, page::Integer) -> Bool
unmark_page_for_flatten(e::DocumentEditor, page::Integer)

편집(redaction)

apply_page_redactions(e::DocumentEditor, page::Integer)
apply_all_redactions(e::DocumentEditor)
is_page_marked_for_redaction(e::DocumentEditor, page::Integer) -> Bool
unmark_page_for_redaction(e::DocumentEditor, page::Integer)
redaction_add(e::DocumentEditor, page::Integer, x1, y1, x2, y2, r, g, b)
redaction_count(e::DocumentEditor, page::Integer) -> Int
redaction_apply(e::DocumentEditor, scrub_metadata::Bool, r::Real, g::Real, b::Real) -> Int
redaction_scrub_metadata(e::DocumentEditor) -> Int
함수 설명
apply_page_redactions(e, page) 페이지의 redaction을 적용(번인)합니다.
apply_all_redactions(e) 대기 중인 모든 redaction을 적용합니다.
is_page_marked_for_redaction(e, page) 페이지가 redaction 대상으로 표시되어 있는지 여부.
unmark_page_for_redaction(e, page) 페이지의 redaction 표시를 제거합니다.
redaction_add(e, page, x1, y1, x2, y2, r, g, b) 오버레이 색상(DeviceRGB, 0–1)을 가진 redaction 박스를 대기열에 추가합니다.
redaction_count(e, page) 페이지에 대기 중인 redaction 영역 수.
redaction_apply(e, scrub_metadata, r, g, b) 대기 중인 모든 redaction을 파괴적으로 적용합니다; 제거된 글리프 수를 반환합니다.
redaction_scrub_metadata(e) Info/XMP/JavaScript/EmbeddedFiles를 제거합니다; 제거된 개수를 반환합니다.

폼 채우기 & 플래튼

set_form_field_value(e::DocumentEditor, name::AbstractString, value::AbstractString)
flatten_forms(e::DocumentEditor)
flatten_forms_on_page(e::DocumentEditor, page::Integer)
flatten_warnings_count(e::DocumentEditor) -> Int
flatten_warning(e::DocumentEditor, index::Integer) -> String
import_fdf_bytes(e::DocumentEditor, data::AbstractVector{UInt8})
import_xfdf_bytes(e::DocumentEditor, data::AbstractVector{UInt8})
함수 설명
set_form_field_value(e, name, value) 폼 필드 값을 설정합니다(UTF-8).
flatten_forms(e) 모든 폼을 플래튼합니다(값을 페이지 콘텐츠에 구워 넣음).
flatten_forms_on_page(e, page) 단일 페이지의 폼을 플래튼합니다.
flatten_warnings_count(e) 마지막 폼 플래튼 저장에서 발생한 경고 수.
flatten_warning(e, index) index번째 플래튼 경고 문자열.
import_fdf_bytes(e, data) 바이트에서 FDF 폼 데이터를 가져옵니다.
import_xfdf_bytes(e, data) 바이트에서 XFDF 폼 데이터를 가져옵니다.

바코드 스탬핑

add_barcode_to_page(e::DocumentEditor, page::Integer, b::Barcode, x, y, width, height)

Barcode를 페이지의 (x, y, width, height) 영역에 스탬프로 찍습니다. 바코드를 참고하세요.

라이프사이클

close!(e::DocumentEditor)는 핸들을 해제합니다.


Pdf

from_* 팩토리가 반환하는 경량의 생성용 핸들입니다.

팩토리

from_markdown(input::AbstractString) -> Pdf
from_html(input::AbstractString) -> Pdf
from_text(input::AbstractString) -> Pdf
from_image(path::AbstractString) -> Pdf
from_image_bytes(data::AbstractVector{UInt8}) -> Pdf
from_html_css(html::AbstractString, css::AbstractString, font_bytes::Union{Nothing,AbstractVector{UInt8}} = nothing) -> Pdf
from_html_css_with_fonts(html::AbstractString, css::AbstractString, families::AbstractVector{<:AbstractString}, fonts::AbstractVector{<:AbstractVector{UInt8}}) -> Pdf
함수 설명
from_markdown(input) Markdown으로부터 Pdf를 만듭니다.
from_html(input) HTML로부터 Pdf를 만듭니다.
from_text(input) 일반 텍스트로부터 Pdf를 만듭니다.
from_image(path) 이미지 파일로부터 Pdf를 만듭니다.
from_image_bytes(data) 메모리상의 이미지 바이트로부터 Pdf를 만듭니다.
from_html_css(html, css, font_bytes=nothing) HTML + CSS와 선택적으로 임베드 글꼴 하나를 사용해 만듭니다.
from_html_css_with_fonts(html, css, families, fonts) HTML + CSS와 다중 글꼴 캐스케이드를 사용해 만듭니다(families[i]fonts[i]의 이름을 지정).

메서드

함수 반환값 설명
save(p, path) 생성된 PDF를 경로에 씁니다.
to_bytes(p) Vector{UInt8} 생성된 PDF를 바이트로 직렬화합니다.
get_page_count(p) Int 빌더 Pdf의 페이지 수.
close!(p) 핸들을 해제합니다.

merge_pdfs

merge_pdfs(paths::AbstractVector{<:AbstractString}) -> Vector{UInt8}

paths의 PDF들을(순서대로) 하나의 PDF 바이트 버퍼로 병합합니다.

오피스 입력

open_from_docx_bytes(data::AbstractVector{UInt8}) -> Pdf
open_from_pptx_bytes(data::AbstractVector{UInt8}) -> Pdf
open_from_xlsx_bytes(data::AbstractVector{UInt8}) -> Pdf

DOCX / PPTX / XLSX 바이트를 Pdf로 변환합니다.


DocumentBuilder

유려하고 구조를 인식하는 PDF 빌더입니다. a4_page / letter_page / page로 페이지를 만들고, 반환된 PageBuilder에 콘텐츠를 배치한 다음 done을 호출해 각 페이지를 커밋하고, 마지막으로 build / save / 암호화 변형을 호출합니다.

DocumentBuilder() -> DocumentBuilder

문서 수준 설정

set_title(b::DocumentBuilder, value::AbstractString)
set_author(b::DocumentBuilder, value::AbstractString)
set_subject(b::DocumentBuilder, value::AbstractString)
set_keywords(b::DocumentBuilder, value::AbstractString)
set_creator(b::DocumentBuilder, value::AbstractString)
on_open(b::DocumentBuilder, value::AbstractString)
language(b::DocumentBuilder, value::AbstractString)
tagged_pdf_ua1(b::DocumentBuilder)
role_map(b::DocumentBuilder, custom::AbstractString, standard::AbstractString)
register_embedded_font(b::DocumentBuilder, name::AbstractString, f::EmbeddedFont)
함수 설명
set_title / set_author / set_subject / set_keywords / set_creator 해당 /Info 메타데이터 필드를 설정합니다.
on_open(b, value) 문서 열기 시 실행되는 JavaScript 액션을 설정합니다.
language(b, value) 문서 언어를 설정합니다(예: "en-US").
tagged_pdf_ua1(b) PDF/UA-1 Tagged-PDF 모드를 활성화합니다.
role_map(b, custom, standard) 커스텀 구조 타입을 표준 타입에 매핑합니다.
register_embedded_font(b, name, f) 로드된 EmbeddedFontname으로 등록합니다(글꼴을 소비합니다).

페이지

a4_page(b::DocumentBuilder) -> PageBuilder
letter_page(b::DocumentBuilder) -> PageBuilder
page(b::DocumentBuilder, width::Real, height::Real) -> PageBuilder

출력

build(b::DocumentBuilder) -> Vector{UInt8}
save(b::DocumentBuilder, path::AbstractString)
save_encrypted_builder(b::DocumentBuilder, path::AbstractString, user_password::AbstractString, owner_password::AbstractString)
to_bytes_encrypted(b::DocumentBuilder, user_password::AbstractString, owner_password::AbstractString) -> Vector{UInt8}
함수 설명
build(b) PDF 바이트를 빌드해 반환합니다(빌더는 이후에도 닫아야 합니다).
save(b, path) 빌드해서 경로에 저장합니다.
save_encrypted_builder(b, path, user_pw, owner_pw) 빌드해서 AES-256 암호화로 저장합니다.
to_bytes_encrypted(b, user_pw, owner_pw) 암호화된 바이트(AES-256)를 빌드합니다.

EmbeddedFont

embedded_font_from_file(path::AbstractString) -> EmbeddedFont
embedded_font_from_bytes(data::AbstractVector{UInt8}; name::Union{Nothing,AbstractString} = nothing) -> EmbeddedFont
함수 설명
embedded_font_from_file(path) 경로에서 TTF/OTF 글꼴을 로드합니다.
embedded_font_from_bytes(data; name) 바이트에서 글꼴을 로드합니다(name을 비워 두면 PostScript 이름을 사용).

PageBuilder

a4_page / letter_page / page가 반환합니다. 모든 메서드는 페이지를 제자리에서 변경하며, done(p)를 호출해 부모 빌더에 커밋합니다(이 호출이 페이지 핸들을 소비합니다).

텍스트 & 레이아웃

font(p::PageBuilder, name::AbstractString, size::Real)
at(p::PageBuilder, x::Real, y::Real)
heading(p::PageBuilder, level::Integer, text::AbstractString)
메서드 설명
font(p, name, size) 이후 텍스트의 글꼴 + 크기를 설정합니다.
at(p, x, y) 커서를 절대 좌표 (x, y)(왼쪽 아래 기준 포인트)로 이동합니다.
heading(p, level, text) level(1–6) 수준의 제목을 출력합니다.

다음 문자열 값 메서드는 모두 f(p::PageBuilder, value::AbstractString) 시그니처를 공유합니다.

메서드 설명
text(p, value) 본문 텍스트 한 줄을 출력합니다.
paragraph(p, value) 줄바꿈된 문단을 출력합니다.
link_url(p, value) 직전 텍스트를 URL 링크로 만듭니다.
link_named(p, value) 직전 텍스트를 명명된 대상에 링크합니다.
link_javascript(p, value) 직전 텍스트에 JavaScript 액션을 연결합니다.
on_open(p, value) 페이지 열기 시 실행되는 JavaScript 액션을 설정합니다.
on_close(p, value) 페이지 닫기 시 실행되는 JavaScript 액션을 설정합니다.
field_keystroke(p, value) / field_format(p, value) / field_validate(p, value) / field_calculate(p, value) AcroForm 필드 JavaScript 액션을 연결합니다.
sticky_note(p, value) 직전 콘텐츠에 스티커 노트를 첨부합니다.
watermark(p, value) 텍스트 워터마크를 추가합니다.
stamp(p, value) 스탬프 주석을 추가합니다.
inline(p, value) 인라인 텍스트 런을 추가합니다.
inline_bold(p, value) 굵게 표시된 인라인 런을 추가합니다.
inline_italic(p, value) 기울임 인라인 런을 추가합니다.

인자가 없는 레이아웃 메서드(모두 f(p::PageBuilder)):

메서드 설명
horizontal_rule(p) 수평선을 그립니다.
space(p) 세로 여백을 삽입합니다.
newline(p) 새 줄로 줄바꿈합니다.
new_page_same_size(p) 동일한 크기로 새 페이지를 시작합니다.
watermark_confidential(p) “CONFIDENTIAL” 워터마크를 추가합니다.
watermark_draft(p) “DRAFT” 워터마크를 추가합니다.
link_page(p::PageBuilder, page_index::Integer)
sticky_note_at(p::PageBuilder, x::Real, y::Real, text::AbstractString)
freetext(p::PageBuilder, x::Real, y::Real, w::Real, h::Real, text::AbstractString)
footnote(p::PageBuilder, ref_mark::AbstractString, note_text::AbstractString)
columns(p::PageBuilder, column_count::Integer, gap_pt::Real, text::AbstractString)
inline_color(p::PageBuilder, r::Real, g::Real, b_::Real, text::AbstractString)
메서드 설명
link_page(p, page_index) 직전 텍스트를 내부 페이지 인덱스에 링크합니다.
sticky_note_at(p, x, y, text) 독립된 스티커 노트를 배치합니다.
freetext(p, x, y, w, h, text) 직사각형 영역에 자유 텍스트 주석을 배치합니다.
footnote(p, ref_mark, note_text) 각주를 추가합니다(인라인 위첨자 + 페이지 끝의 본문).
columns(p, column_count, gap_pt, text) 텍스트를 균형 잡힌 여러 단으로 배치합니다.
inline_color(p, r, g, b_, text) RGB 색상의 인라인 런을 추가합니다(채널 0–1).

마크업 주석

네 메서드 모두 f(p::PageBuilder, r::Real, g::Real, b_::Real)를 공유하며 직전 텍스트에 RGB 색상을 적용합니다.

메서드 설명
highlight(p, r, g, b) 직전 텍스트를 하이라이트합니다.
underline(p, r, g, b) 직전 텍스트에 밑줄을 긋습니다.
strikeout(p, r, g, b) 직전 텍스트에 취소선을 긋습니다.
squiggly(p, r, g, b) 직전 텍스트에 물결 밑줄을 긋습니다.

폼 위젯

text_field(p::PageBuilder, name, x, y, w, h; default_value::Union{Nothing,AbstractString} = nothing)
checkbox(p::PageBuilder, name, x, y, w, h, checked::Bool)
combo_box(p::PageBuilder, name, x, y, w, h, options::AbstractVector{<:AbstractString}; selected::Union{Nothing,AbstractString} = nothing)
radio_group(p::PageBuilder, name, values, xs, ys, ws, hs; selected::Union{Nothing,AbstractString} = nothing)
push_button(p::PageBuilder, name, x, y, w, h, caption::AbstractString)
signature_field(p::PageBuilder, name, x, y, w, h)
메서드 설명
text_field(p, name, x, y, w, h; default_value) 한 줄 텍스트 필드를 추가합니다.
checkbox(p, name, x, y, w, h, checked) 초기 체크 상태를 가진 체크박스를 추가합니다.
combo_box(p, name, x, y, w, h, options; selected) 드롭다운 콤보박스를 추가합니다.
radio_group(p, name, values, xs, ys, ws, hs; selected) 라디오 그룹을 추가합니다(각 버튼을 병렬 배열로 기술).
push_button(p, name, x, y, w, h, caption) 클릭 가능한 푸시 버튼을 추가합니다.
signature_field(p, name, x, y, w, h) 서명되지 않은 서명 자리표시자를 추가합니다.

이미지 & 바코드

image(p::PageBuilder, bytes::AbstractVector{UInt8}, x, y, w, h)
image_with_alt(p::PageBuilder, bytes::AbstractVector{UInt8}, x, y, w, h, alt_text::AbstractString)
image_artifact(p::PageBuilder, bytes::AbstractVector{UInt8}, x, y, w, h)
barcode_1d(p::PageBuilder, barcode_type::Integer, data::AbstractString, x, y, w, h)
barcode_qr(p::PageBuilder, data::AbstractString, x, y, size::Real)
메서드 설명
image(p, bytes, x, y, w, h) 이미지를 임베드합니다(원시 JPEG/PNG/WebP).
image_with_alt(p, bytes, x, y, w, h, alt_text) 접근성 대체 텍스트와 함께 이미지를 임베드합니다.
image_artifact(p, bytes, x, y, w, h) 장식용 이미지를 /Artifact로 임베드합니다.
barcode_1d(p, barcode_type, data, x, y, w, h) 1차원 바코드를 배치합니다(barcode_type: 0=Code128…7=Codabar).
barcode_qr(p, data, x, y, size) 정사각형 QR 코드를 배치합니다.

벡터 그래픽

rect(p::PageBuilder, x, y, w, h)
filled_rect(p::PageBuilder, x, y, w, h, r, g, b_)
line(p::PageBuilder, x1, y1, x2, y2)
stroke_rect(p::PageBuilder, x, y, w, h, width, r, g, b_)
stroke_line(p::PageBuilder, x1, y1, x2, y2, width, r, g, b_)
stroke_rect_dashed(p::PageBuilder, x, y, w, h, width, r, g, b_, dash_array::AbstractVector{<:Real}, phase::Real)
stroke_line_dashed(p::PageBuilder, x1, y1, x2, y2, width, r, g, b_, dash_array::AbstractVector{<:Real}, phase::Real)
text_in_rect(p::PageBuilder, x, y, w, h, text::AbstractString, align::Integer)
메서드 설명
rect(p, x, y, w, h) 1pt 검정 외곽선 직사각형.
filled_rect(p, x, y, w, h, r, g, b) RGB(0–1)로 채운 직사각형.
line(p, x1, y1, x2, y2) 1pt 검정 선.
stroke_rect(p, x, y, w, h, width, r, g, b) widthpt RGB 선으로 그린 직사각형.
stroke_line(p, x1, y1, x2, y2, width, r, g, b) widthpt RGB 선.
stroke_rect_dashed(...) 점선 직사각형(dash_array는 켜짐/꺼짐 길이, phase는 오프셋).
stroke_line_dashed(...) 점선 선.
text_in_rect(p, x, y, w, h, text, align) 직사각형 안에 텍스트를 그립니다(align: 0=왼쪽, 1=가운데, 2=오른쪽).

table(p::PageBuilder, n_columns::Integer, widths::AbstractVector{<:Real}, aligns::AbstractVector{<:Integer}, n_rows::Integer, cell_strings::AbstractMatrix{<:AbstractString}, has_header::Bool)
streaming_table_begin(p::PageBuilder, headers::AbstractVector{<:AbstractString}, widths::AbstractVector{<:Real}, aligns::AbstractVector{<:Integer}, repeat_header::Bool)
streaming_table_begin_v2(p::PageBuilder, headers, widths, aligns, repeat_header::Bool, mode::Integer, sample_rows::Integer, min_col_width_pt::Real, max_col_width_pt::Real, max_rowspan::Integer)
streaming_table_set_batch_size(p::PageBuilder, batch_size::Integer)
streaming_table_pending_row_count(p::PageBuilder) -> Int
streaming_table_batch_count(p::PageBuilder) -> Int
streaming_table_push_row(p::PageBuilder, cells::AbstractVector{<:AbstractString})
streaming_table_push_row_v2(p::PageBuilder, cells::AbstractVector{<:AbstractString}, rowspans::AbstractVector{<:Integer})
streaming_table_flush(p::PageBuilder)
streaming_table_finish(p::PageBuilder)
메서드 설명
table(p, n_columns, widths, aligns, n_rows, cell_strings, has_header) 버퍼링된 표를 출력합니다(aligns: 0=왼쪽/1=가운데/2=오른쪽; cell_strings는 행 우선 n_rows × n_columns).
streaming_table_begin(p, headers, widths, aligns, repeat_header) 스트리밍 표를 엽니다(길이 n_columns의 병렬 배열).
streaming_table_begin_v2(...) 너비 mode(0=Fixed, 1=Sample, 2=AutoAll)와 max_rowspan을 지정해 스트리밍 표를 엽니다.
streaming_table_set_batch_size(p, batch_size) 배치 크기를 설정합니다(0 → 256).
streaming_table_pending_row_count(p) 마지막 배치 경계 이후 추가된 행 수.
streaming_table_batch_count(p) 지금까지 완료된 배치 수.
streaming_table_push_row(p, cells) 행 하나를 추가합니다(rowspan=1).
streaming_table_push_row_v2(p, cells, rowspans) 셀별 rowspan(≥2)을 지정해 행 하나를 추가합니다.
streaming_table_flush(p) 현재 배치를 플러시합니다.
streaming_table_finish(p) 스트리밍 표를 마무리합니다.

커밋

done(p::PageBuilder)   # commit this page's buffered operations to its parent builder (consumes the handle)

값 타입

추출에서 반환되는 불변 struct입니다. Bboxx, y, width, height 필드(PDF 사용자 공간 단위)를 가집니다.

타입 필드
Bbox x, y, width, height(Float64)
Char character::UInt32, bbox::Bbox, font_name::String, font_size::Float64
Word text, bbox, font_name, font_size, bold
TextLine text, bbox, word_count
Table row_count, col_count, has_header, cells(0부터 시작하는 셀은 cell(t, row, col) 사용)
Font name, type, encoding, embedded, subset
Image width, height, bitsPerComponent, format, colorspace, data
Annotation type, subtype, content, author, rect::Bbox, borderWidth
Path bbox::Bbox, strokeWidth, hasStroke, hasFill, operationCount
SearchResult text, page, bbox::Bbox
FormField name, value, type, readonly, required
PdfVersion major::Int, minor::Int
cell(t::Table, row::Integer, col::Integer) -> String

FormField 접근자

form_field_name(f::FormField) -> String
form_field_value(f::FormField) -> String
form_field_type(f::FormField) -> String
form_field_is_readonly(f::FormField) -> Bool
form_field_is_required(f::FormField) -> Bool

ElementList

element_count(l::ElementList) -> Int
element_type(l::ElementList, index::Integer) -> String
element_text(l::ElementList, index::Integer) -> String
element_rect(l::ElementList, index::Integer) -> Bbox
elements_to_json(l::ElementList) -> String
close!(l::ElementList)

전자서명

Certificate

certificate_load_from_bytes(data::AbstractVector{UInt8}, password::AbstractString = "") -> Certificate
certificate_load_from_pem(cert_pem::AbstractString, key_pem::AbstractString) -> Certificate
certificate_get_subject(c::Certificate) -> String
certificate_get_issuer(c::Certificate) -> String
certificate_get_serial(c::Certificate) -> String
certificate_get_validity(c::Certificate) -> Tuple{Int,Int}
certificate_is_valid(c::Certificate) -> Bool
함수 설명
certificate_load_from_bytes(data, password="") PKCS#12 / PFX 바이트에서 서명용 자격 증명을 로드합니다.
certificate_load_from_pem(cert_pem, key_pem) PEM으로 인코딩된 인증서 + 개인키에서 로드합니다.
certificate_get_subject(c) / certificate_get_issuer(c) / certificate_get_serial(c) 주체 / 발급자 / 일련번호 문자열.
certificate_get_validity(c) (not_before, not_after) 유효 기간을 유닉스 에포크 초로 반환합니다.
certificate_is_valid(c) 인증서가 현재 유효한지 여부.

서명

sign_bytes(pdf::AbstractVector{UInt8}, cert::Certificate, reason::AbstractString, location::AbstractString) -> Vector{UInt8}
sign_bytes_pades(pdf::AbstractVector{UInt8}, cert::Certificate, level::Integer, tsa_url::Union{Nothing,AbstractString}, reason::AbstractString, location::AbstractString; certs = Vector{UInt8}[], crls = Vector{UInt8}[], ocsps = Vector{UInt8}[]) -> Vector{UInt8}
sign_bytes_pades_opts(pdf::AbstractVector{UInt8}, cert::Certificate, level::Integer, tsa_url, reason, location; certs = Vector{UInt8}[], crls = Vector{UInt8}[], ocsps = Vector{UInt8}[]) -> Vector{UInt8}
add_timestamp(pdf_data::AbstractVector{UInt8}, sig_index::Integer, tsa_url::AbstractString) -> Vector{UInt8}
함수 설명
sign_bytes(pdf, cert, reason, location) 원시 PDF 바이트에 서명합니다; 서명된 PDF를 반환합니다.
sign_bytes_pades(pdf, cert, level, tsa_url, reason, location; certs, crls, ocsps) PAdES 베이스라인 서명입니다(level: 0=B-B, 1=B-T, 2=B-LT; level ≥ 1이면 tsa_url이 필요).
sign_bytes_pades_opts(...) sign_bytes_pades의 struct 옵션 변형입니다(동작은 동일하며 PadesSignOptionsC를 빌드).
add_timestamp(pdf_data, sig_index, tsa_url) 서명에 RFC 3161 타임스탬프를 추가합니다; 타임스탬프가 찍힌 PDF를 반환합니다.

SignatureInfo

signature_get_signer_name(s::SignatureInfo) -> String
signature_get_signing_reason(s::SignatureInfo) -> String
signature_get_signing_location(s::SignatureInfo) -> String
signature_get_signing_time(s::SignatureInfo) -> Int
signature_get_certificate(s::SignatureInfo) -> Certificate
signature_get_pades_level(s::SignatureInfo) -> Int
signature_has_timestamp(s::SignatureInfo) -> Bool
signature_get_timestamp(s::SignatureInfo) -> Timestamp
signature_add_timestamp(s::SignatureInfo, ts) -> Bool
signature_verify(s::SignatureInfo) -> Int
signature_verify_detached(s::SignatureInfo, pdf::AbstractVector{UInt8}) -> Int
함수 설명
signature_get_signer_name(s) / _reason(s) / _location(s) 서명자 이름 / 사유 / 위치.
signature_get_signing_time(s) 서명 시각(유닉스 에포크 초).
signature_get_certificate(s) 서명자의 Certificate(소유권 보유).
signature_get_pades_level(s) PAdES 레벨 코드.
signature_has_timestamp(s) 임베드된 RFC 3161 타임스탬프가 있는지 여부.
signature_get_timestamp(s) 임베드된 Timestamp(소유권 보유).
signature_add_timestamp(s, ts) Timestamp를 첨부합니다; 성공 시 true를 반환합니다.
signature_verify(s) 서명자 속성 암호화 검사입니다(1=유효, 0=무효, -1=알 수 없음).
signature_verify_detached(s, pdf) 전체 PDF 바이트에 대해 종단 간 검증을 수행합니다(1/0/-1).

Timestamp

timestamp_parse(data::AbstractVector{UInt8}) -> Timestamp
timestamp_get_token(t::Timestamp) -> Vector{UInt8}
timestamp_get_message_imprint(t::Timestamp) -> Vector{UInt8}
timestamp_get_time(t::Timestamp) -> Int
timestamp_get_serial(t::Timestamp) -> String
timestamp_get_tsa_name(t::Timestamp) -> String
timestamp_get_policy_oid(t::Timestamp) -> String
timestamp_get_hash_algorithm(t::Timestamp) -> Int
timestamp_verify(t::Timestamp) -> Bool
함수 설명
timestamp_parse(data) DER로 인코딩된 RFC 3161 TimeStampToken(또는 단독 TSTInfo)을 파싱합니다.
timestamp_get_token(t) 원시 토큰 바이트.
timestamp_get_message_imprint(t) 메시지 임프린트 다이제스트 바이트.
timestamp_get_time(t) 타임스탬프 시각(유닉스 에포크 초).
timestamp_get_serial(t) 일련번호 문자열.
timestamp_get_tsa_name(t) TSA 이름.
timestamp_get_policy_oid(t) 정책 OID.
timestamp_get_hash_algorithm(t) 다이제스트 알고리즘 코드.
timestamp_verify(t) 토큰이 검증되는지 여부.

TsaClient

tsa_client_create(url::AbstractString; username = nothing, password = nothing, timeout::Integer = 30, hash_algo::Integer = 0, use_nonce::Bool = true, cert_req::Bool = true) -> TsaClient
tsa_request_timestamp(t::TsaClient, data::AbstractVector{UInt8}) -> Timestamp
tsa_request_timestamp_hash(t::TsaClient, hash::AbstractVector{UInt8}, hash_algo::Integer) -> Timestamp
함수 설명
tsa_client_create(url; …) RFC 3161 TSA 클라이언트를 만듭니다(선택적 basic-auth, 타임아웃, 해시 알고리즘, nonce, cert-req).
tsa_request_timestamp(t, data) data에 대한 타임스탬프를 요청합니다(네트워크 I/O).
tsa_request_timestamp_hash(t, hash, hash_algo) 미리 계산된 다이제스트에 대한 타임스탬프를 요청합니다.

Dss (Document Security Store)

dss_cert_count(d::Dss) -> Int
dss_crl_count(d::Dss) -> Int
dss_ocsp_count(d::Dss) -> Int
dss_vri_count(d::Dss) -> Int
dss_get_cert(d::Dss, index::Integer) -> Vector{UInt8}
dss_get_crl(d::Dss, index::Integer) -> Vector{UInt8}
dss_get_ocsp(d::Dss, index::Integer) -> Vector{UInt8}
함수 설명
dss_cert_count(d) / dss_crl_count(d) / dss_ocsp_count(d) / dss_vri_count(d) 인증서 / CRL / OCSP 응답 / VRI 항목 수.
dss_get_cert(d, index) / dss_get_crl(d, index) / dss_get_ocsp(d, index) index번째 인증서 / CRL / OCSP 응답 바이트.

검증 결과

validate_pdf_a / validate_pdf_ua / validate_pdf_x는 각각 PdfAResults / UaResults / PdfXResults를 반환합니다.

함수 반환값 설명
is_compliant(r::PdfAResults) Bool 문서가 PDF/A를 준수하는지 여부.
is_compliant(r::PdfXResults) Bool 문서가 PDF/X를 준수하는지 여부.
is_accessible(r::UaResults) Bool 문서가 PDF/UA 접근성을 충족하는지 여부.
errors(r) Vector{String} 오류 메시지(PdfAResults / UaResults / PdfXResults).
warnings(r) Vector{String} 경고 메시지.
ua_stats(r::UaResults) NamedTuple 접근성 요소 개수 (structure, images, tables, forms, annotations, pages).
pdf_a_error_count(r) / pdf_a_warning_count(r) Int PDF/A 오류 / 경고 개수.
pdf_ua_error_count(r) / pdf_ua_warning_count(r) Int PDF/UA 오류 / 경고 개수.
pdf_x_error_count(r) Int PDF/X 오류 개수.

바코드

generate_qr_code(data::AbstractString, error_correction::Integer = 0, size_px::Integer = 256) -> Barcode
generate_barcode(data::AbstractString, format::Integer = 0, size_px::Integer = 256) -> Barcode
barcode_get_data(b::Barcode) -> String
barcode_get_format(b::Barcode) -> Int
barcode_get_confidence(b::Barcode) -> Float64
barcode_get_image_png(b::Barcode, size_px::Integer = 256) -> Vector{UInt8}
barcode_get_svg(b::Barcode, size_px::Integer = 256) -> String
함수 설명
generate_qr_code(data, error_correction=0, size_px=256) QR 코드를 생성합니다.
generate_barcode(data, format=0, size_px=256) 1D/2D 바코드를 생성합니다.
barcode_get_data(b) 디코딩/인코딩된 페이로드 문자열.
barcode_get_format(b) 형식 코드.
barcode_get_confidence(b) 디코딩 신뢰도(0.0–1.0).
barcode_get_image_png(b, size_px=256) PNG 바이트로 렌더링합니다.
barcode_get_svg(b, size_px=256) SVG 문자열로 렌더링합니다.

add_barcode_to_page(e, page, b, x, y, width, height)로 에디터 페이지에 바코드를 스탬프로 찍습니다.


OCR

OcrEngine

ocr_engine_create(det_model_path::AbstractString, rec_model_path::AbstractString, dict_path::AbstractString) -> OcrEngine

검출 모델, 인식 모델, 사전 파일 경로로부터 OCR 엔진을 만듭니다. ocr_extract_text(doc, page, engine)page_needs_ocr(doc, page)에서 사용합니다(PdfDocument › OCR 참고). close!(o::OcrEngine)로 해제합니다.

모델 프리페치

prefetch_models(languages_csv::AbstractString) -> String
prefetch_available() -> Int
model_manifest() -> String
함수 설명
prefetch_models(languages_csv) 쉼표로 구분한 언어들에 대해 OCR/레이아웃 모델을 미리 가져옵니다.
prefetch_available() 모델 프리페치를 사용할 수 있는지 여부.
model_manifest() 번들된 모델 매니페스트(JSON/문자열).

전역 설정 & 암호화

set_log_level(level::Integer)   # 0=Off 1=Error 2=Warn 3=Info 4=Debug 5=Trace
get_log_level() -> Int
set_max_ops_per_stream(limit::Integer) -> Int
set_preserve_unmapped_glyphs(preserve::Integer) -> Int
함수 설명
set_log_level(level) 전역 로그 레벨을 설정합니다(0–5).
get_log_level() 현재 전역 로그 레벨을 가져옵니다.
set_max_ops_per_stream(limit) 스트림당 콘텐츠 연산 한도를 설정합니다; 이전 한도를 반환합니다.
set_preserve_unmapped_glyphs(preserve) 매핑되지 않은 글리프 보존 여부를 전환합니다; 이전 설정을 반환합니다.

암호화 정책 & 인벤토리

crypto_active_provider() -> String
crypto_cbom() -> String
crypto_inventory() -> String
crypto_policy() -> String
crypto_set_policy(spec::AbstractString) -> Int
crypto_fips_available() -> Int
crypto_use_fips() -> Int
함수 설명
crypto_active_provider() 현재 활성화된 암호화 프로바이더 이름.
crypto_cbom() 암호화 자재 명세(Cryptographic Bill of Materials, JSON).
crypto_inventory() 암호화 알고리즘 인벤토리(JSON).
crypto_policy() 현재 활성화된 암호화 정책.
crypto_set_policy(spec) spec으로 활성 암호화 정책을 설정합니다; 상태 코드를 반환합니다.
crypto_fips_available() FIPS 프로바이더를 사용할 수 있는지 여부.
crypto_use_fips() FIPS 모드가 활성화되어 있는지 여부.

오류 처리

성공이 아닌 C-ABI 상태 코드는 모두 PdfOxideError를 던집니다.

using PdfOxide

try
    doc = open_document("file.pdf")
    text = extract_text(doc, 0)
    close!(doc)
catch e
    if e isa PdfOxideError
        @warn "PDF error" code=e.code op=e.op
    else
        rethrow()
    end
end

PdfOxideError <: Exception은 숫자로 된 C-ABI code와 실패한 연산 이름을 담습니다.


전체 예제

using PdfOxide

# --- Creation ---
doc_bytes = let b = DocumentBuilder()
    set_title(b, "Report")
    p = letter_page(b)
    font(p, "Helvetica", 18)
    at(p, 72, 720)
    heading(p, 1, "Quarterly Report")
    paragraph(p, "Generated by PDF Oxide.")
    done(p)
    out = build(b)
    close!(b)
    out
end

# --- Extraction ---
doc = open_from_bytes(doc_bytes)
println("Pages: ", page_count(doc))
for i in 0:page_count(doc)-1
    println("Page ", i + 1, ": ", length(extract_text(doc, i)), " chars")
end

# Words + tables
words = extract_words(doc, 0)
tables = extract_tables(doc, 0)

# Search
for hit in search_all(doc, "report", false)
    println("Found on page ", hit.page, " at ", hit.bbox)
end
close!(doc)

# --- Editing ---
e = open_editor("input.pdf")
rotate_all_pages(e, 90)
set_form_field_value(e, "name", "Jane Doe")
flatten_forms(e)
save(e, "output.pdf")
close!(e)

# --- Rendering ---
doc = open_document("input.pdf")
img = render_page(doc, 0)          # PNG
save(img, "page0.png")
close!(img)
close!(doc)

Other Language Bindings

PDF Oxide는 모든 주요 생태계를 위한 네이티브 바인딩을 제공합니다: Rust, Python, Node.js, WASM, C#, Golang, Java, PHP, Ruby, C++, Swift, Kotlin, Dart, R, Zig, Scala, Clojure, Objective-C, Elixir

다음 단계