Documentation
¶
Overview ¶
Package pdf2mt converts a PDF to a token-efficient hybrid document following the LLM Data Format strategy defined in llm-data-format.md:
- Markdown headers for section hierarchy
- TOON blocks for all uniform arrays, comma separator by default: name[N]{f1,f2}: / pipe separator when values contain commas: name[N]{f1,f2}(|):
- Plain Markdown prose for narrative text
Conversion is done via the Claude API with vision input (one page at a time). Pages are rasterized using pdftoppm (from poppler-utils).
Environment:
ANTHROPIC_API_KEY — required
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// DPI used when rasterizing pages (default 150).
DPI int
// Model is the Claude model (default "claude-sonnet-4-6").
Model string
// OutputFile, if set, writes the resulting document to this path.
OutputFile string
// ExtractImages, if true, extracts figures that cannot be represented as
// text or a table and writes them as PNG files alongside the output document.
// Each extracted figure replaces its "> [Figure N: ...]" marker with a
// Markdown image link "".
ExtractImages bool
// ImageDPI, if non-zero, overrides DPI when rasterizing pages for figure
// extraction. Use a higher value (e.g. 300) for better image quality.
// Has no effect when ExtractImages is false. Defaults to DPI.
ImageDPI int
}
Options controls conversion behaviour.