Rust API 레퍼런스
이 페이지는 pdf_oxide의 모든 공개 구조체와 메서드를 문서화합니다. Python 바인딩은 Python API 레퍼런스를 참조하세요. 타입 및 열거형 상세 정보는 타입 & 열거형을 참조하세요.
PdfDocument
저수준 문서 핸들입니다. PDF 파일을 열고, 텍스트, 이미지, 메타데이터를 추출합니다.
use pdf_oxide::PdfDocument;
열기 및 인증
| 메서드 | Signature | 설명 |
|---|---|---|
open |
fn open(path: impl AsRef<Path>) -> Result<Self> |
디스크에서 PDF 파일 열기 |
open_from_bytes |
fn open_from_bytes(data: Vec<u8>) -> Result<Self> |
메모리 바이트에서 PDF 열기 |
open_with_config |
fn open_with_config(path: impl AsRef<Path>, config: impl Any) -> Result<Self> |
파서 구성으로 열기 |
authenticate |
fn authenticate(&mut self, password: &[u8]) -> Result<bool> |
사용자 또는 소유자 비밀번호로 인증 |
메타데이터
| 메서드 | Signature | 설명 |
|---|---|---|
page_count |
fn page_count(&mut self) -> Result<usize> |
문서의 페이지 수 |
page_count_u32 |
fn page_count_u32(&mut self) -> u32 |
페이지 수 as u32 (0 on error) |
version |
fn version(&self) -> (u8, u8) |
PDF version as (major, minor) |
trailer |
fn trailer(&self) -> &Object |
원시 트레일러 딕셔너리 |
catalog |
fn catalog(&mut self) -> Result<Object> |
문서 카탈로그 딕셔너리 |
텍스트 추출
| 메서드 | Signature | 설명 |
|---|---|---|
extract_text |
fn extract_text(&mut self, page_index: usize) -> Result<String> |
단일 페이지의 일반 텍스트 |
extract_all_text |
fn extract_all_text(&mut self) -> Result<String> |
모든 페이지의 일반 텍스트 |
extract_spans |
fn extract_spans(&mut self, page_index: usize) -> Result<Vec<TextSpan>> |
글꼴 메타데이터가 있는 텍스트 런 |
extract_spans_with_config |
fn extract_spans_with_config(&mut self, page_index: usize, config: &TextConfig) -> Result<Vec<TextSpan>> |
Spans with custom configuration |
extract_chars |
fn extract_chars(&mut self, page_index: usize) -> Result<Vec<TextChar>> |
문자별 위치 및 메타데이터 |
extract_text_with_ocr |
fn extract_text_with_ocr(&mut self, page_index: usize) -> Result<String> |
Text with OCR fallback for scanned pages |
extract_spans_with_ocr |
fn extract_spans_with_ocr(&mut self, page_index: usize) -> Result<Vec<TextSpan>> |
Spans with OCR fallback |
apply_intelligent_text_processing |
fn apply_intelligent_text_processing(&self, spans: Vec<TextSpan>) -> Vec<TextSpan> |
Ligature expansion, hyphen reconstruction, OCR cleanup |
extract_hierarchical_content |
fn extract_hierarchical_content(&mut self, page_index: usize) -> Result<Vec<ContentElement>> |
Structured content tree from tagged PDFs |
Conversion
| 메서드 | Signature | 설명 |
|---|---|---|
to_markdown |
fn to_markdown(&mut self, page_index: usize, options: &ConversionOptions) -> Result<String> |
Convert page to Markdown |
to_html |
fn to_html(&mut self, page_index: usize, options: &ConversionOptions) -> Result<String> |
Convert page to HTML |
to_plain_text |
fn to_plain_text(&mut self, page_index: usize) -> Result<String> |
Convert page to plain text |
to_markdown_all |
fn to_markdown_all(&mut self, options: &ConversionOptions) -> Result<String> |
모든 페이지를 Markdown으로 |
to_html_all |
fn to_html_all(&mut self, options: &ConversionOptions) -> Result<String> |
모든 페이지를 HTML로 |
to_plain_text_all |
fn to_plain_text_all(&mut self) -> Result<String> |
모든 페이지를 일반 텍스트로 |
to_markdown_with_ocr |
fn to_markdown_with_ocr(&mut self, page_index: usize, options: &ConversionOptions) -> Result<String> |
Markdown with OCR fallback |
Image Extraction
| 메서드 | Signature | 설명 |
|---|---|---|
extract_images |
fn extract_images(&mut self, page_index: usize) -> Result<Vec<ImageInfo>> |
Image metadata and raw data from a page |
extract_images_to_files |
fn extract_images_to_files(&mut self, page_index: usize, output_dir: &str) -> Result<Vec<PathBuf>> |
Extract and save images to disk |
Path and Graphics Extraction
| 메서드 | Signature | 설명 |
|---|---|---|
extract_paths |
fn extract_paths(&mut self, page_index: usize) -> Result<Vec<PathContent>> |
Vector graphics from a page |
extract_paths_in_rect |
fn extract_paths_in_rect(&mut self, page_index: usize, rect: Rect) -> Result<Vec<PathContent>> |
Paths within a rectangular region |
Page Information
| 메서드 | Signature | 설명 |
|---|---|---|
get_page_info |
fn get_page_info(&mut self, page_index: usize) -> Result<PageInfo> |
페이지 크기, 회전, 박스 |
get_page_resources |
fn get_page_resources(&mut self, page_index: usize) -> Result<Object> |
Raw resources dictionary |
get_page_content_data |
fn get_page_content_data(&mut self, page_index: usize) -> Result<Vec<u8>> |
Raw content stream bytes |
Structure and Accessibility
| 메서드 | Signature | 설명 |
|---|---|---|
structure_tree |
fn structure_tree(&mut self) -> Result<Option<StructTreeRoot>> |
Tagged structure tree |
mark_info |
fn mark_info(&mut self) -> Result<MarkInfo> |
MarkInfo dictionary (tagged, suspects) |
Low-Level
| 메서드 | Signature | 설명 |
|---|---|---|
load_object |
fn load_object(&mut self, obj_ref: ObjectRef) -> Result<Object> |
Load a PDF object by reference |
resolve_object |
fn resolve_object(&mut self, obj: &Object) -> Result<Object> |
Resolve indirect references |
resolve_references |
fn resolve_references(&mut self, obj: &Object, max_depth: usize) -> Result<Object> |
Recursively resolve all references |
check_for_circular_references |
fn check_for_circular_references(&mut self) -> Vec<(ObjectRef, ObjectRef)> |
Detect circular reference chains |
통합 고수준 API입니다. 추출, 생성, 편집, 검색, 규정 준수를 위한 하나의 타입입니다.
use pdf_oxide::api::Pdf;
생성자s
| 메서드 | Signature | 설명 |
|---|---|---|
new |
fn new() -> Self |
Create an empty Pdf instance |
open |
fn open(path: impl AsRef<Path>) -> Result<Self> |
기존 PDF 열기 |
open_editor |
fn open_editor(path: impl AsRef<Path>) -> Result<DocumentEditor> |
구조적 편집용으로 열기 |
from_markdown |
fn from_markdown(content: &str) -> Result<Self> |
Create PDF from Markdown |
from_html |
fn from_html(content: &str) -> Result<Self> |
Create PDF from HTML |
from_text |
fn from_text(content: &str) -> Result<Self> |
Create PDF from plain text |
from_image |
fn from_image(path: impl AsRef<Path>) -> Result<Self> |
Create PDF from image file |
from_image_bytes |
fn from_image_bytes(data: &[u8]) -> Result<Self> |
Create PDF from image bytes |
from_images |
fn from_images<P: AsRef<Path>>(paths: &[P]) -> Result<Self> |
Multi-page from images |
from_qrcode |
fn from_qrcode(data: &str) -> Result<Self> |
PDF containing a QR code |
from_qrcode_with_options |
fn from_qrcode_with_options(data: &str, size: f32, ecl: &str) -> Result<Self> |
QR code with custom size and error correction |
from_barcode |
fn from_barcode(data: &str, barcode_type: BarcodeType) -> Result<Self> |
PDF containing a barcode |
from_barcode_with_options |
fn from_barcode_with_options(data: &str, barcode_type: BarcodeType, width: f32, height: f32) -> Result<Self> |
Barcode with custom dimensions |
추출
| 메서드 | Signature | 설명 |
|---|---|---|
page_count |
fn page_count(&mut self) -> Result<usize> |
Number of pages |
page |
fn page(&mut self, index: usize) -> Result<PdfPage> |
DOM-like page handle |
to_markdown |
fn to_markdown(&mut self, page: usize) -> Result<String> |
Page to Markdown |
to_html |
fn to_html(&mut self, page: usize) -> Result<String> |
Page to HTML |
to_text |
fn to_text(&mut self, page: usize) -> Result<String> |
Page to plain text |
검색
| 메서드 | Signature | 설명 |
|---|---|---|
search |
fn search(&mut self, pattern: &str) -> Result<Vec<SearchResult>> |
모든 페이지 검색 |
search_with_options |
fn search_with_options(&mut self, pattern: &str, opts: &SearchOptions) -> Result<Vec<SearchResult>> |
Search with options |
search_page |
fn search_page(&mut self, page: usize, pattern: &str) -> Result<Vec<SearchResult>> |
단일 페이지 검색 |
highlight_matches |
fn highlight_matches(&mut self, pattern: &str) -> Result<usize> |
하이라이트 주석 추가s for matches |
메타데이터
| 메서드 | Signature | 설명 |
|---|---|---|
set_title |
fn set_title(&mut self, title: impl Into<String>) -> Result<()> |
문서 제목 설정 |
set_author |
fn set_author(&mut self, author: impl Into<String>) -> Result<()> |
저자 설정 |
set_subject |
fn set_subject(&mut self, subject: impl Into<String>) -> Result<()> |
주제 설정 |
set_keywords |
fn set_keywords(&mut self, keywords: impl Into<String>) -> Result<()> |
키워드 설정 |
XMP Metadata
| 메서드 | Signature | 설명 |
|---|---|---|
xmp_metadata |
fn xmp_metadata(&mut self) -> Result<Option<XmpMetadata>> |
Full XMP metadata |
has_xmp_metadata |
fn has_xmp_metadata(&mut self) -> Result<bool> |
Check XMP presence |
xmp_title |
fn xmp_title(&mut self) -> Result<Option<String>> |
XMP dc:title |
xmp_creators |
fn xmp_creators(&mut self) -> Result<Vec<String>> |
XMP dc:creator list |
xmp_description |
fn xmp_description(&mut self) -> Result<Option<String>> |
XMP dc:description |
xmp_creator_tool |
fn xmp_creator_tool(&mut self) -> Result<Option<String>> |
XMP xmp:CreatorTool |
xmp_create_date |
fn xmp_create_date(&mut self) -> Result<Option<String>> |
XMP xmp:CreateDate |
xmp_modify_date |
fn xmp_modify_date(&mut self) -> Result<Option<String>> |
XMP xmp:ModifyDate |
xmp_producer |
fn xmp_producer(&mut self) -> Result<Option<String>> |
XMP pdf:Producer |
Page Labels
| 메서드 | Signature | 설명 |
|---|---|---|
page_labels |
fn page_labels(&mut self) -> Result<Vec<PageLabelRange>> |
Page label ranges |
page_label |
fn page_label(&mut self, page: usize) -> Result<String> |
Label for a specific page |
all_page_labels |
fn all_page_labels(&mut self) -> Result<Vec<String>> |
Labels for every page |
페이지 작업
| 메서드 | Signature | 설명 |
|---|---|---|
page_rotation |
fn page_rotation(&mut self, page: usize) -> Result<i32> |
Current rotation in degrees |
set_page_rotation |
fn set_page_rotation(&mut self, page: usize, degrees: i32) -> Result<()> |
절대 회전 설정 |
rotate_page |
fn rotate_page(&mut self, page: usize, degrees: i32) -> Result<()> |
Add relative rotation |
rotate_all_pages |
fn rotate_all_pages(&mut self, degrees: i32) -> Result<()> |
모든 페이지 회전 |
page_media_box |
fn page_media_box(&mut self, page: usize) -> Result<[f32; 4]> |
MediaBox dimensions |
set_page_media_box |
fn set_page_media_box(&mut self, page: usize, rect: [f32; 4]) -> Result<()> |
Set MediaBox |
page_crop_box |
fn page_crop_box(&mut self, page: usize) -> Result<Option<[f32; 4]>> |
CropBox dimensions |
set_page_crop_box |
fn set_page_crop_box(&mut self, page: usize, rect: [f32; 4]) -> Result<()> |
Set CropBox |
crop_margins |
fn crop_margins(&mut self, left: f32, right: f32, top: f32, bottom: f32) -> Result<()> |
Crop all pages by margins |
Content Editing
| 메서드 | Signature | 설명 |
|---|---|---|
save_page |
fn save_page(&mut self, page: PdfPage) -> Result<()> |
Save modified page back |
erase_region |
fn erase_region(&mut self, page: usize, rect: [f32; 4]) -> Result<()> |
White-out a rectangular area |
erase_regions |
fn erase_regions(&mut self, page: usize, rects: &[[f32; 4]]) -> Result<()> |
White-out multiple areas |
clear_erase_regions |
fn clear_erase_regions(&mut self, page: usize) |
Clear pending erase operations |
Annotations
| 메서드 | Signature | 설명 |
|---|---|---|
flatten_page_annotations |
fn flatten_page_annotations(&mut self, page: usize) -> Result<()> |
Flatten annotations on a page |
flatten_all_annotations |
fn flatten_all_annotations(&mut self) -> Result<()> |
모든 주석 플래튼 |
is_page_marked_for_flatten |
fn is_page_marked_for_flatten(&self, page: usize) -> bool |
Check flatten status |
unmark_page_for_flatten |
fn unmark_page_for_flatten(&mut self, page: usize) |
Unmark a page |
Forms
| 메서드 | Signature | 설명 |
|---|---|---|
flatten_forms_on_page |
fn flatten_forms_on_page(&mut self, page: usize) -> Result<()> |
Flatten forms on a page |
flatten_forms |
fn flatten_forms(&mut self) -> Result<()> |
모든 양식 필드 평탄화 |
is_page_marked_for_form_flatten |
fn is_page_marked_for_form_flatten(&self, page: usize) -> bool |
Check if page forms are marked for flatten |
will_remove_acroform |
fn will_remove_acroform(&self) -> bool |
Check if AcroForm will be removed on save |
export_form_data_fdf |
fn export_form_data_fdf(&mut self, output_path: impl AsRef<Path>) -> Result<()> |
Export form data as FDF |
export_form_data_xfdf |
fn export_form_data_xfdf(&mut self, output_path: impl AsRef<Path>) -> Result<()> |
Export form data as XFDF |
Redactions
| 메서드 | Signature | 설명 |
|---|---|---|
apply_page_redactions |
fn apply_page_redactions(&mut self, page: usize) -> Result<()> |
Apply redactions on a page |
apply_all_redactions |
fn apply_all_redactions(&mut self) -> Result<()> |
Apply all pending redactions |
is_page_marked_for_redaction |
fn is_page_marked_for_redaction(&self, page: usize) -> bool |
Check if page has pending redactions |
unmark_page_for_redaction |
fn unmark_page_for_redaction(&mut self, page: usize) |
Remove pending redactions for a page |
Images
| 메서드 | Signature | 설명 |
|---|---|---|
page_images |
fn page_images(&mut self, page: usize) -> Result<Vec<ImageInfo>> |
List images on a page |
reposition_image |
fn reposition_image(&mut self, page: usize, image_index: usize, x: f32, y: f32) -> Result<()> |
Move an image |
resize_image |
fn resize_image(&mut self, page: usize, image_index: usize, width: f32, height: f32) -> Result<()> |
Resize an image |
set_image_bounds |
fn set_image_bounds(&mut self, page: usize, image_index: usize, rect: [f32; 4]) -> Result<()> |
Set image bounding box |
clear_image_modifications |
fn clear_image_modifications(&mut self, page: usize) |
Clear pending image modifications |
has_image_modifications |
fn has_image_modifications(&self, page: usize) -> bool |
Check for pending image modifications |
임베디드 파일
| 메서드 | Signature | 설명 |
|---|---|---|
embed_file |
fn embed_file(&mut self, name: &str, data: Vec<u8>) -> Result<()> |
Attach a file |
embed_file_with_options |
fn embed_file_with_options(&mut self, file: EmbeddedFile) -> Result<()> |
Attach with full config |
pending_embedded_files |
fn pending_embedded_files(&self) -> &[EmbeddedFile] |
List pending file attachments |
clear_embedded_files |
fn clear_embedded_files(&mut self) |
Clear pending file attachments |
Rendering (requires rendering feature)
| 메서드 | Signature | 설명 |
|---|---|---|
render_page |
fn render_page(&mut self, page: usize) -> Result<RenderedImage> |
Render to image |
render_page_with_options |
fn render_page_with_options(&mut self, page: usize, opts: &RenderOptions) -> Result<RenderedImage> |
Render with options |
render_page_to_file |
fn render_page_to_file(&mut self, page: usize, path: impl AsRef<Path>) -> Result<()> |
Render and save to file |
render_page_to_file_with_dpi |
fn render_page_to_file_with_dpi(&mut self, page: usize, path: impl AsRef<Path>, dpi: f32) -> Result<()> |
Render with custom DPI |
저장
| 메서드 | Signature | 설명 |
|---|---|---|
save |
fn save(&mut self, path: impl AsRef<Path>) -> Result<()> |
Save to file |
save_as |
fn save_as(&mut self, path: impl AsRef<Path>) -> Result<()> |
Save to a different file |
save_encrypted |
fn save_encrypted(&mut self, path: impl AsRef<Path>, user_password: &str, owner_password: &str) -> Result<()> |
비밀번호 보호로 저장 |
save_with_encryption |
fn save_with_encryption(&mut self, path: impl AsRef<Path>, config: EncryptionConfig) -> Result<()> |
Save with full encryption config |
as_bytes |
fn as_bytes(&self) -> &[u8] |
PDF bytes (creation mode) |
into_bytes |
fn into_bytes(mut self) -> Vec<u8> |
Consume and return PDF bytes |
to_bytes |
fn to_bytes(&mut self) -> Result<Vec<u8>> |
Generate PDF bytes |
to_markdown_file |
fn to_markdown_file(&mut self, path: impl AsRef<Path>) -> Result<()> |
Save all pages as Markdown file |
접근자
| 메서드 | Signature | 설명 |
|---|---|---|
source_path |
fn source_path(&self) -> Option<&Path> |
Path of the opened file |
editor |
fn editor(&mut self) -> Option<&mut DocumentEditor> |
Access the underlying editor |
config |
fn config(&self) -> &PdfConfig |
Current configuration |
is_modified |
fn is_modified(&self) -> bool |
문서에 저장되지 않은 변경 사항이 있는지 |
PdfBuilder
메타데이터 및 레이아웃 구성으로 PDF를 생성하기 위한 플루언트 빌더입니다.
use pdf_oxide::api::PdfBuilder;
use pdf_oxide::writer::PageSize;
| 메서드 | Signature | 설명 |
|---|---|---|
new |
fn new() -> Self |
Create a new builder |
title |
fn title(self, title: impl Into<String>) -> Self |
제목 설정 |
author |
fn author(self, author: impl Into<String>) -> Self |
저자 설정 |
subject |
fn subject(self, subject: impl Into<String>) -> Self |
주제 설정 |
keywords |
fn keywords(self, keywords: impl Into<String>) -> Self |
키워드 설정 |
page_size |
fn page_size(self, size: PageSize) -> Self |
페이지 크기 설정 |
margin |
fn margin(self, margin: f32) -> Self |
Set uniform margins |
margins |
fn margins(self, left: f32, right: f32, top: f32, bottom: f32) -> Self |
Set individual margins |
font_size |
fn font_size(self, size: f32) -> Self |
글꼴 크기 설정 |
line_height |
fn line_height(self, height: f32) -> Self |
줄 높이 설정 |
from_markdown |
fn from_markdown(self, content: &str) -> Result<Pdf> |
Markdown에서 생성 |
from_html |
fn from_html(self, content: &str) -> Result<Pdf> |
HTML에서 생성 |
from_text |
fn from_text(self, content: &str) -> Result<Pdf> |
일반 텍스트에서 생성 |
from_image |
fn from_image(self, path: impl AsRef<Path>) -> Result<Pdf> |
이미지에서 생성 |
from_image_bytes |
fn from_image_bytes(self, data: &[u8]) -> Result<Pdf> |
이미지에서 생성 bytes |
from_images |
fn from_images<P: AsRef<Path>>(self, paths: &[P]) -> Result<Pdf> |
Build from multiple images |
from_qrcode |
fn from_qrcode(self, data: &str) -> Result<Pdf> |
Build from QR code data |
from_barcode |
fn from_barcode(self, data: &str, barcode_type: BarcodeType) -> Result<Pdf> |
Build from barcode data |
DocumentBuilder
픽셀 정밀 페이지 레이아웃을 위한 저수준 빌더입니다.
use pdf_oxide::writer::DocumentBuilder;
| 메서드 | Signature | 설명 |
|---|---|---|
new |
fn new() -> Self |
Create a new builder |
metadata |
fn metadata(self, metadata: DocumentMetadata) -> Self |
문서 메타데이터 설정 |
page |
fn page(&mut self, size: PageSize) -> FluentPageBuilder |
Add a page with named size |
letter_page |
fn letter_page(&mut self) -> FluentPageBuilder |
Add US Letter page |
a4_page |
fn a4_page(&mut self) -> FluentPageBuilder |
Add A4 page |
build |
fn build(self) -> Result<Vec<u8>> |
Generate PDF bytes |
save |
fn save(self, path: impl AsRef<Path>) -> Result<()> |
Save to file |
FluentPageBuilder
Returned by DocumentBuilder::page(). Chain calls to add content to a page:
| 메서드 | 설명 |
|---|---|
text(text, x, y, size) |
Place text at exact coordinates |
heading(level, text) |
Add a heading (H1-H6) |
paragraph(text) |
Add a paragraph with auto-wrap |
space(points) |
Add vertical space |
horizontal_rule() |
Draw a horizontal line |
link_url(url) |
Add a URL link annotation |
link_page(page) |
Add internal page link |
highlight(color) |
하이라이트 주석 추가 |
underline(color) |
Add underline annotation |
strikeout(color) |
Add strikeout annotation |
sticky_note(text) |
Add a sticky note |
stamp(stamp_type) |
Add a stamp annotation |
freetext(rect, text) |
Add free text annotation |
watermark(text) |
Add watermark overlay |
add_annotation(annotation) |
모든 주석 유형 추가 |
done() |
Finish page, return to builder |
DocumentEditor
구조적 수정을 위해 기존 PDF를 엽니다.
use pdf_oxide::editor::DocumentEditor;
핵심
| 메서드 | Signature | 설명 |
|---|---|---|
open |
fn open(path: impl AsRef<Path>) -> Result<Self> |
편집용으로 파일 열기 |
is_modified |
fn is_modified(&self) -> bool |
Check for unsaved changes |
source_path |
fn source_path(&self) -> &str |
Original file path |
source |
fn source(&self) -> &PdfDocument |
Underlying document (read) |
source_mut |
fn source_mut(&mut self) -> &mut PdfDocument |
Underlying document (write) |
version |
fn version(&self) -> (u8, u8) |
PDF version |
current_page_count |
fn current_page_count(&self) -> usize |
페이지 수 |
메타데이터
| 메서드 | 설명 |
|---|---|
title() / set_title() |
Get/set document title |
author() / set_author() |
Get/set author |
subject() / set_subject() |
Get/set subject |
keywords() / set_keywords() |
Get/set keywords |
페이지 작업
| 메서드 | 설명 |
|---|---|
get_page_rotation() / set_page_rotation() |
Get/set rotation |
rotate_page_by() |
Add relative rotation |
rotate_all_pages() |
모든 페이지 회전 |
get_page_media_box() / set_page_media_box() |
Get/set MediaBox |
get_page_crop_box() / set_page_crop_box() |
Get/set CropBox |
crop_margins() |
Crop all pages by margins |
erase_region() / erase_regions() |
White-out content |
extract_pages() |
Extract pages to separate file |
merge_from() / merge_pages_from() |
다른 PDF에서 페이지 병합 |
DOM 스타일 편집
| 메서드 | Signature | 설명 |
|---|---|---|
get_page |
fn get_page(&mut self, page_index: usize) -> Result<PdfPage> |
Get DOM page handle |
save_page |
fn save_page(&mut self, page: PdfPage) -> Result<()> |
Save modified page |
edit_page |
fn edit_page<F>(&mut self, page_index: usize, f: F) -> Result<()> |
Edit with closure |
page_editor |
fn page_editor(&mut self, page_index: usize) -> Result<PageEditor> |
Get page editor |
get_page_content |
fn get_page_content(&mut self, page_index: usize) -> Result<Option<StructureElement>> |
Get page structure |
set_page_content |
fn set_page_content(&mut self, page_index: usize, content: StructureElement) -> Result<()> |
Set page structure |
modify_structure |
fn modify_structure<F>(&mut self, page_index: usize, f: F) -> Result<()> |
Modify structure with closure |
Form Fields
| 메서드 | 설명 |
|---|---|
get_form_fields() |
모든 양식 필드 나열 |
get_form_field_value(name) |
Get field value by name |
set_form_field_value(name, value: FormFieldValue) |
Set field value by name |
has_form_field(name) |
Check field existence |
add_form_field(widget) |
Add a new form field |
flatten_forms_on_page(page) |
Flatten forms on a page |
flatten_forms() |
모든 양식 필드 평탄화 |
export_form_data_fdf(path) |
Export as FDF |
export_form_data_xfdf(path) |
Export as XFDF |
has_xfa() |
Check for XFA forms |
analyze_xfa() |
Analyze XFA form data |
convert_xfa_to_acroform() |
Convert XFA to AcroForm |
주석 및 플래튼
| 메서드 | 설명 |
|---|---|
flatten_page_annotations(page) |
Flatten annotations on a page |
flatten_all_annotations() |
모든 주석 플래튼 |
get_page_annotations(page) |
List annotations on a page |
임베디드 파일
| 메서드 | 설명 |
|---|---|
embed_file(name, data) |
Attach a file |
embed_file_with_options(file) |
Attach with full config |
pending_embedded_files() |
List pending attachments |
clear_embedded_files() |
Clear pending attachments |
DOM 타입
PdfPage
쿼리 가능하고 편집 가능한 요소를 가진 단일 페이지를 나타냅니다.
| 메서드 | 설명 |
|---|---|
elements() |
All elements on the page |
text_elements() |
Only text elements |
image_elements() |
Only image elements |
path_elements() |
Only path/graphics elements |
table_elements() |
Only table elements |
find_text_containing(needle) |
부분 문자열과 일치하는 텍스트 찾기 |
set_text(id, new_text) |
텍스트 교체 by element ID |
PdfText
| 메서드 | Return | 설명 |
|---|---|---|
id() |
ElementId |
Unique element identifier |
text() |
&str |
텍스트 콘텐츠 |
bbox() |
Rect |
바운딩 직사각형 |
font_name() |
&str |
글꼴 이름 |
font_size() |
f32 |
글꼴 크기(포인트) |
is_bold() |
bool |
굵게 |
is_italic() |
bool |
기울임꼴 |
color() |
Color |
텍스트 색상 |
set_text(new) |
텍스트 교체 | |
append(text) |
Append text | |
replace(old, new) |
usize |
Replace occurrences |
clear() |
Clear text |
PdfImage
| 메서드 | Return | 설명 |
|---|---|---|
id() |
ElementId |
Unique identifier |
bbox() |
Rect |
바운딩 직사각형 |
format() |
ImageFormat |
이미지 형식 |
dimensions() |
(u32, u32) |
Width and height in pixels |
aspect_ratio() |
f32 |
Width / height ratio |
is_grayscale() |
bool |
Grayscale check |
alt_text() |
Option<&str> |
Alt text for accessibility |
resolution() |
Option<(f32, f32)> |
DPI as (horizontal, vertical) |
PdfPath
| 메서드 | Return | 설명 |
|---|---|---|
id() |
ElementId |
Unique identifier |
bbox() |
Rect |
바운딩 직사각형 |
operations() |
&[PathOperation] |
Path drawing operations |
stroke_color() |
Option<Color> |
스트로크 색상 |
fill_color() |
Option<Color> |
채우기 색상 |
stroke_width() |
f32 |
선 너비 |
line_cap() |
LineCap |
Line cap style |
line_join() |
LineJoin |
Line join style |
is_closed() |
bool |
Whether path is closed |
to_svg() |
String |
Convert to SVG path data |
to_svg_document() |
String |
Convert to standalone SVG |
PdfTable
| 메서드 | Return | 설명 |
|---|---|---|
id() |
ElementId |
Unique identifier |
bbox() |
Rect |
바운딩 직사각형 |
row_count() |
usize |
Number of rows |
column_count() |
usize |
Number of columns |
has_header() |
bool |
Whether first row is a header |
get_cell(row, col) |
Option<&TableCellContent> |
셀 내용 |
caption() |
Option<&str> |
테이블 캡션 |
TextSearcher
use pdf_oxide::search::{TextSearcher, SearchOptions, SearchResult};
검색Options
| Field | 타입 | 기본값 | 설명 |
|---|---|---|---|
case_sensitive |
bool |
true |
Case-sensitive matching |
literal |
bool |
false |
Treat pattern as literal (not regex) |
whole_word |
bool |
false |
전체 단어만 매칭 |
max_results |
Option<usize> |
None |
Limit number of results |
page_range |
Option<(usize, usize)> |
None |
Restrict to page range |
검색Result
| Field | 타입 | 설명 |
|---|---|---|
page |
usize |
Page index |
text |
String |
일치된 텍스트 |
x |
f64 |
X position in points |
y |
f64 |
Y position in points |
FormField 및 XmpExtractor
FormField (읽기)
| Field | 타입 | 설명 |
|---|---|---|
name |
String |
Fully qualified field name |
field_type |
FieldType |
Text, Button, Choice, Signature |
value |
Option<String> |
현재 값 |
rect |
Option<Rect> |
Widget bounds |
flags |
u32 |
필드 플래그 |
XmpExtractor
use pdf_oxide::extractors::xmp::XmpExtractor;
Static methods that operate on a PdfDocument:
| 메서드 | Return | 설명 |
|---|---|---|
extract(doc) |
Result<Option<XmpMetadata>> |
Extract XMP metadata |
XmpMetadata
| Field | 타입 | 설명 |
|---|---|---|
title |
Option<String> |
dc:title |
creators |
Vec<String> |
dc:creator |
description |
Option<String> |
dc:description |
creator_tool |
Option<String> |
xmp:CreatorTool |
create_date |
Option<String> |
xmp:CreateDate |
modify_date |
Option<String> |
xmp:ModifyDate |
producer |
Option<String> |
pdf:Producer |
PageLabelExtractor
use pdf_oxide::extractors::page_labels::PageLabelExtractor;
| 메서드 | Return | 설명 |
|---|---|---|
extract(doc) |
Result<Vec<PageLabelRange>> |
Extract page label definitions |
label_for_page(doc, page) |
Result<String> |
Compute label for a specific page |
all_labels(doc) |
Result<Vec<String>> |
Compute labels for every page |
독립 함수
use pdf_oxide::document::{parse_header, parse_trailer};
| Function | Signature | 설명 |
|---|---|---|
parse_header |
fn parse_header<R: Read + Seek>(reader: &mut R, lenient: bool) -> Result<(u8, u8, u64)> |
Parse PDF header, returns (major, minor, byte_offset) |
parse_trailer |
fn parse_trailer<R: Read>(reader: &mut R) -> Result<Object> |
Parse the trailer dictionary |
다음 단계
- Python API 레퍼런스 – Python 바인딩 레퍼런스
- 타입 & 열거형 – 모든 타입, 열거형 및 구성 구조체
- Rust 시작하기 – 예제가 있는 튜토리얼