lmpdf reference
Complete CLI subcommands and flags, Docx and Pptx schema types and methods, standard lmcode_std_v3 catalog, and exit codes for lmpdf.
CLI subcommands and flags
| Command or flag | Arguments | Description |
|---|---|---|
| lmpdf --version | none | Print the lmpdf version string and exit 0. |
| lmpdf docx --lmcode-schema | [--json] | Print human-readable docx schema summary or exact embedded JSON schema bytes. |
| lmpdf docx --lmcode-signatures | [--without-std] | Print canonical signatures for the docx route (optionally excluding lmcode_std_v3). |
| lmpdf docx --lmcode | [--no-tagged] FILE [--lmcode FILE ...] | Execute one or more compiled bytecode files against the docx PDF layout route. |
| lmpdf docx --to-markdown | FILE.pdf | Extract Markdown text from a PDF document. |
| lmpdf pptx --lmcode-schema | [--json] | Print human-readable pptx schema summary or exact embedded JSON schema bytes. |
| lmpdf pptx --lmcode-signatures | [--without-std] | Print canonical signatures for the pptx route (optionally excluding lmcode_std_v3). |
| lmpdf pptx --lmcode | [--no-tagged] FILE [--lmcode FILE ...] | Execute one or more compiled bytecode files against the pptx 16:9 slide deck PDF route. |
| lmpdf inspect | FILE.pdf [--markdown] | Inspect a PDF file and return a JSON summary containing page, image, table, and link counts plus extracted text. |
Document schema (lmpdf docx)
| Type / context | Method signature | Description |
|---|---|---|
| context docx: DocxHost | docx.create(string) -> Docx | Create a new paginated PDF document builder writing to the given output path. |
| DocxHost | docx.inspect(string) -> string | docx.to_markdown(string) -> string | docx.sample_image(string) -> void | Inspect a PDF as JSON, convert a PDF to Markdown, or write a deterministic 64x64 sample PNG image. |
| Docx | d.heading(string, int) -> Paragraph | d.paragraph(string) -> Paragraph | d.bullet(string) -> Paragraph | d.numbered(string) -> Paragraph | Append a heading (level 1..6), body paragraph, bulleted item, or numbered list item. |
| Docx | d.clause(string, int) -> Paragraph | d.signature(string) -> Paragraph | Append a numbered legal clause (level 1..3) or signature block line. |
| Docx | d.table(int, int) -> Table | d.image(string, int, int) -> Docx | d.text_box(string, float, float) -> Docx | Append a rows-by-cols table, an inline image (path, width_px, height_px), or a bordered text box. |
| Docx | d.page_break() -> Docx | d.section_break(string) -> Docx | d.columns(int, float) -> Docx | Insert a page or section break, or configure multi-column flow (count, gap_pt). |
| Docx | d.header(string) | d.footer(string) | d.header_fields(string) | d.footer_fields(string) -> Docx | Configure running headers and footers with optional {PAGE} and {NUMPAGES} placeholders. |
| Docx | d.title(string) | d.author(string) | d.font(string) | d.font_size(float) -> Docx | Set PDF metadata title/author and default document font family and size in points. |
| Docx | d.page_size(float, float) | d.orientation(string) | d.margins(float, float, float, float) -> Docx | Set page width/height in points, portrait/landscape orientation, and top/right/bottom/left margins. |
| Docx | d.toc(string, int) | d.heading_numbering(bool) -> Docx | Insert a generated table of contents with page numbers or enable hierarchical heading numbering. |
| Docx | d.markdown(string) | d.markdown_file(string) | d.html_doc(string, string) | d.html_xml(string, string) -> Docx | Append content from Markdown text/file, html-doc@1 / css-doc@1 strings, or html-subset@1 / css-subset@1 strings. |
| Docx | d.save() -> void | Render layout via Typst and write the tagged PDF/A-2b and PDF/UA-1 file to disk. |
| Paragraph | p.bold(bool) | p.italic(bool) | p.size(float) | p.color(string) | p.align(string) | p.font(string) -> Paragraph | Configure paragraph font weight, style, point size, hex color, alignment, and font family. |
| Paragraph | p.spacing(float, float, float) | p.indent(float, float, float) | p.keep_with_next(bool) | p.tab_stop(float, string) -> Paragraph | Configure paragraph spacing, indentation, pagination keep-with-next, and tab stop position/alignment. |
| Paragraph | p.hyperlink(string, string) | p.footnote(string) | p.comment(string, string) | p.inserted(string, string) | p.deleted(string, string) -> Paragraph | Append a hyperlink, numbered page-bottom footnote, comment, or tracked insertion/deletion annotation. |
| Table | t.cell(int, int, string) -> Table | t.paragraph(int, int, string) -> Paragraph | Set 1-based table cell text or return a stylable Paragraph inside a cell. |
| Table | t.borders(bool) | t.column_width(int, float) | t.shade(int, int, string) | t.merge(int, int, int, int) | t.cell_border(int, int, string, string, int) -> Table | Configure table borders, column widths, cell background shading, rectangular cell merges, or custom cell borders. |
Slide deck schema (lmpdf pptx)
| Type / context | Method signature | Description |
|---|---|---|
| context pptx: PptxHost | pptx.create(string) -> Pptx | pptx.inspect(string) -> string | pptx.to_markdown(string) -> string | pptx.sample_image(string) -> void | Create a 16:9 PDF slide deck builder, inspect or extract Markdown from a PDF, or write a 64x64 sample PNG. |
| Pptx | p.slide() -> Slide | p.theme(string, string, string, string) -> Pptx | p.markdown(string) -> Pptx | p.save() -> void | Add a slide, configure theme palette (primary, accent, background, text), build slides from Markdown, or write the PDF deck. |
| Slide | s.title(string) | s.title_slide(string, string) | s.section_header(string, string, string) | s.two_content(string, string, string) -> Slide | Set slide title or populate standard title, section-header, or two-column slide layouts. |
| Slide | s.text(float, float, float, float, string) | s.bullet(float, float, float, float, string) | s.hyperlink(float, float, float, float, string, string) -> Slide | Place a positioned text box, bullet box, or hyperlink at (x, y, w, h) on the 1280x720 canvas. |
| Slide | s.image(string, float, float, float, float) | s.rect(float, float, float, float, string) | s.rounded_rect(float, float, float, float, string, string) | s.ellipse(float, float, float, float, string, string) -> Slide | Place an image, filled rectangle, rounded rectangle, or ellipse at (x, y, w, h). |
| Slide | s.line(float, float, float, float, string, float) | s.arrow(float, float, float, float, string, float) -> Slide | Draw a line or arrow from (x1, y1) to (x2, y2) with hex color and stroke width. |
| Slide | s.notes(string) | s.footer(string) | s.slide_number(bool) | s.transition(string) -> Slide | Attach speaker notes, slide footer text, slide number display, or transition metadata. |
| Slide | s.table(float, float, float, float, int, int) -> PptxTable | Create a slide table at (x, y, w, h) with the given row and column counts. |
| Slide | s.bar_chart(float, float, float, float, string, string, string, string) | s.line_chart(float, float, float, float, string, string, string, string) | s.pie_chart(float, float, float, float, string, string, string) -> Slide | Render a bar, line, or pie chart at (x, y, w, h) on the slide. |
| PptxTable | t.cell(int, int, string) | t.cell_bg(int, int, string) | t.cell_color(int, int, string) | t.bold(int, int, bool) | t.font_size(int, int, float) | t.align(int, int, string) | t.header_row(string, string) -> PptxTable | Populate and style 1-based slide table cells and header rows. |
Standard lmcode_std_v3 catalog
| Category or interface | Functions, types, or signatures | Description |
|---|---|---|
| Strings, math, and files | str_len, str_substr, str_find, str_contains, str_starts_with, str_ends_with, str_lower, str_upper, str_trim, str_replace, str_repeat, str_split, str_match, str_to_int, str_is_int, str_to_float, str_is_float, str_base64_encode, str_base64_decode, str_hex_encode, str_hex_decode, math_abs, math_min, math_max, math_floor, math_ceil, math_round, math_sqrt, math_pow, file_read, file_write, file_append, file_exists, file_lines | Standard string processing, numeric math, encoding, and UTF-8 file helpers. |
| Collections, JSON, and return framing | IntList, FloatList, StrList, IntMap, FloatMap, StrMap, IntStack, FloatStack, StrStack, IntQueue, FloatQueue, StrQueue, IntPQ, FloatPQ, StrPQ, Json (json_parse, template_render), lmcode_return_set, lmcode_return_put, lmcode_return_put_null, lmcode_return_null | Typed containers, JSON parsing, template rendering, and structured LMCODE_RETURN payload builders. |
Exit codes
| Exit code | Phase | Meaning |
|---|---|---|
| 0 | success | PDF rendering, dry validation, or inspection succeeded and emitted an LMCODE_RETURN frame. |
| 2 | cli | Invalid CLI argument, retired flag (such as --first or --last), or malformed invocation manifest (such as missing/non-boolean dry). |
| 3 | load / run | Bytecode load failure, schema mismatch, VM runtime error, or html_doc / html_xml dry validation failure. |
| 4 | app | Application, Typst layout, missing input file, or output path write failure. |