Skip to content

Document

Excel, PDF, and Word document read/write/convert.

8 modules

ModuleDescription
Excel 읽기Excel 파일(xlsx, xls)에서 데이터 읽기
Excel 쓰기Excel 파일(xlsx)에 데이터 쓰기
PDF 폼 채우기PDF 폼 필드에 데이터 채우기 및 선택적으로 이미지 삽입
PDF 생성HTML 콘텐츠 또는 텍스트에서 PDF 파일 생성
PDF 파싱PDF 파일에서 텍스트 및 메타데이터 추출
PDF를 Word로PDF 파일을 Word 문서(.docx)로 변환
Word 문서 파싱Word 문서(.docx)에서 텍스트 및 콘텐츠 추출
Word를 PDF로 변환Word 문서(.docx)를 PDF 파일로 변환

Modules

Excel 읽기

excel.read

Excel 파일(xlsx, xls)에서 데이터 읽기

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the Excel file
sheetstringNo-Sheet name (default: first sheet)
header_rownumberNo1Row number for headers (1-based, 0 for no headers)
rangestringNo-Cell range to read (e.g., "A1:D10")
as_dictbooleanNoTrueReturn rows as dictionaries (using headers as keys)

Output:

FieldTypeDescription
dataarray추출된 데이터 행
headersarray추출된 데이터 행
row_countnumber추출된 데이터 행
sheet_namesarray열 헤더

Example: Read entire sheet

yaml
path: /tmp/data.xlsx
as_dict: true

Excel 쓰기

excel.write

Excel 파일(xlsx)에 데이터 쓰기

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the Excel file
dataarrayYes-Data to write (array of arrays or array of objects)
headersarrayNo-Column headers (auto-detected from objects if not provided)
sheet_namestringNoSheet1Name of the worksheet
auto_widthbooleanNoTrueAutomatically adjust column widths

Output:

FieldTypeDescription
pathstring생성된 Excel 파일 경로
row_countnumber생성된 Excel 파일 경로
sizenumber생성된 Excel 파일 경로

Example: Write data to Excel

yaml
path: /tmp/output.xlsx
data: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]

PDF 폼 채우기

pdf.fill_form

PDF 폼 필드에 데이터 채우기 및 선택적으로 이미지 삽입

Parameters:

NameTypeRequiredDefaultDescription
templatestringYes-Path to the PDF template file
outputstringYes-Path for the output document
fieldsobjectNo{}Key-value pairs of form field names and values
imagesarrayNo[]List of images to insert with position info
flattenbooleanNoTrueFlatten form fields (make them non-editable)

Output:

FieldTypeDescription
output_pathstring채워진 PDF 경로
fields_fillednumber채워진 PDF 경로
images_insertednumber채워진 PDF 경로
file_size_bytesnumber삽입된 이미지 수

Example: Fill form with text fields

yaml
template: /templates/form.pdf
output: /output/filled.pdf
fields: {"name": "John Doe", "id_number": "A123456789", "date": "2024-01-01"}

Example: Fill form with photo

yaml
template: /templates/id_card.pdf
output: /output/id_card_filled.pdf
fields: {"name": "Jane Doe"}
images: [{"file": "/photos/jane.jpg", "page": 1, "x": 50, "y": 650, "width": 100, "height": 120}]

PDF 생성

pdf.generate

HTML 콘텐츠 또는 텍스트에서 PDF 파일 생성

Parameters:

NameTypeRequiredDefaultDescription
contentstringYes-HTML or text content to convert to PDF
output_pathstringYes-Path for the output document
titlestringNo-Document title (metadata)
authorstringNo-Document author (metadata)
page_sizeselect (A4, Letter, Legal, A3, A5)NoA4Page size format
orientationselect (portrait, landscape)NoportraitPage orientation
marginnumberNo20Page margin in millimeters
headerstringNo-Header text for each page
footerstringNo-Footer text for each page

Output:

FieldTypeDescription
output_pathstring생성된 PDF 경로
page_countnumber생성된 PDF 경로
file_size_bytesnumberPDF의 페이지 수

Example: Generate from HTML

yaml
content: <h1>Report</h1><p>Content here</p>
output_path: /path/to/report.pdf
title: Monthly Report

PDF 파싱

pdf.parse

PDF 파일에서 텍스트 및 메타데이터 추출

Parameters:

NameTypeRequiredDefaultDescription
pathstringYes-Path to the PDF file
pagesstringNoallPage range (e.g., "1-5", "1,3,5", or "all")
extract_imagesbooleanNoFalseExtract embedded images
extract_tablesbooleanNoFalseExtract tables as structured data

Output:

FieldTypeDescription
textstring추출된 텍스트 콘텐츠
pagesarray추출된 텍스트 콘텐츠
metadataobject추출된 텍스트 콘텐츠
page_countnumber페이지별 텍스트 콘텐츠

Example: Extract all text from PDF

yaml
path: /tmp/document.pdf
pages: all

PDF를 Word로

pdf.to_word

PDF 파일을 Word 문서(.docx)로 변환

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Path to the input document
output_pathstringNo-Path for the output document
preserve_formattingbooleanNoTruePreserve basic formatting
pagesstringNoallPage range (e.g., "1-5", "1,3,5", or "all")

Output:

FieldTypeDescription
output_pathstring생성된 Word 문서 경로
page_countnumber생성된 Word 문서 경로
file_sizenumber변환된 페이지 수

Example: Convert entire PDF to Word

yaml
input_path: /tmp/document.pdf

Example: Convert specific pages

yaml
input_path: /tmp/document.pdf
output_path: /tmp/output.docx
pages: 1-5

Word 문서 파싱

word.parse

Word 문서(.docx)에서 텍스트 및 콘텐츠 추출

Parameters:

NameTypeRequiredDefaultDescription
file_pathstringYes-Path to the Word document (.docx)
extract_tablesbooleanNoTrueExtract tables as structured data
extract_imagesbooleanNoFalseExtract embedded images
images_output_dirstringNo-Directory to save extracted images
preserve_formattingbooleanNoFalsePreserve basic formatting

Output:

FieldTypeDescription
textstring문서의 전체 텍스트 콘텐츠
paragraphsarray문서의 전체 텍스트 콘텐츠
tablesarray문서의 전체 텍스트 콘텐츠
imagesarray단락 목록
metadataobject배열로 추출된 테이블

Example: Extract text from Word

yaml
file_path: /path/to/document.docx

Example: Extract with tables and images

yaml
file_path: /path/to/document.docx
extract_tables: true
extract_images: true
images_output_dir: /path/to/images/

Word를 PDF로 변환

word.to_pdf

Word 문서(.docx)를 PDF 파일로 변환

Parameters:

NameTypeRequiredDefaultDescription
input_pathstringYes-Path to the input document
output_pathstringNo-Path for the output document
methodselect (auto, libreoffice, docx2pdf)NoautoMethod to use for conversion

Output:

FieldTypeDescription
output_pathstring생성된 PDF 파일 경로
file_sizenumber생성된 PDF 파일 경로
method_usedstring출력 파일 크기 (바이트)

Example: Convert Word to PDF

yaml
input_path: /tmp/document.docx

Example: Convert with specific output path

yaml
input_path: /tmp/document.docx
output_path: /tmp/output.pdf

Released under the Apache 2.0 License.