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 flagArgumentsDescription
lmpdf --versionnonePrint 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-markdownFILE.pdfExtract 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 inspectFILE.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 / contextMethod signatureDescription
context docx: DocxHostdocx.create(string) -> DocxCreate a new paginated PDF document builder writing to the given output path.
DocxHostdocx.inspect(string) -> string | docx.to_markdown(string) -> string | docx.sample_image(string) -> voidInspect a PDF as JSON, convert a PDF to Markdown, or write a deterministic 64x64 sample PNG image.
Docxd.heading(string, int) -> Paragraph | d.paragraph(string) -> Paragraph | d.bullet(string) -> Paragraph | d.numbered(string) -> ParagraphAppend a heading (level 1..6), body paragraph, bulleted item, or numbered list item.
Docxd.clause(string, int) -> Paragraph | d.signature(string) -> ParagraphAppend a numbered legal clause (level 1..3) or signature block line.
Docxd.table(int, int) -> Table | d.image(string, int, int) -> Docx | d.text_box(string, float, float) -> DocxAppend a rows-by-cols table, an inline image (path, width_px, height_px), or a bordered text box.
Docxd.page_break() -> Docx | d.section_break(string) -> Docx | d.columns(int, float) -> DocxInsert a page or section break, or configure multi-column flow (count, gap_pt).
Docxd.header(string) | d.footer(string) | d.header_fields(string) | d.footer_fields(string) -> DocxConfigure running headers and footers with optional {PAGE} and {NUMPAGES} placeholders.
Docxd.title(string) | d.author(string) | d.font(string) | d.font_size(float) -> DocxSet PDF metadata title/author and default document font family and size in points.
Docxd.page_size(float, float) | d.orientation(string) | d.margins(float, float, float, float) -> DocxSet page width/height in points, portrait/landscape orientation, and top/right/bottom/left margins.
Docxd.toc(string, int) | d.heading_numbering(bool) -> DocxInsert a generated table of contents with page numbers or enable hierarchical heading numbering.
Docxd.markdown(string) | d.markdown_file(string) | d.html_doc(string, string) | d.html_xml(string, string) -> DocxAppend content from Markdown text/file, html-doc@1 / css-doc@1 strings, or html-subset@1 / css-subset@1 strings.
Docxd.save() -> voidRender layout via Typst and write the tagged PDF/A-2b and PDF/UA-1 file to disk.
Paragraphp.bold(bool) | p.italic(bool) | p.size(float) | p.color(string) | p.align(string) | p.font(string) -> ParagraphConfigure paragraph font weight, style, point size, hex color, alignment, and font family.
Paragraphp.spacing(float, float, float) | p.indent(float, float, float) | p.keep_with_next(bool) | p.tab_stop(float, string) -> ParagraphConfigure paragraph spacing, indentation, pagination keep-with-next, and tab stop position/alignment.
Paragraphp.hyperlink(string, string) | p.footnote(string) | p.comment(string, string) | p.inserted(string, string) | p.deleted(string, string) -> ParagraphAppend a hyperlink, numbered page-bottom footnote, comment, or tracked insertion/deletion annotation.
Tablet.cell(int, int, string) -> Table | t.paragraph(int, int, string) -> ParagraphSet 1-based table cell text or return a stylable Paragraph inside a cell.
Tablet.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) -> TableConfigure table borders, column widths, cell background shading, rectangular cell merges, or custom cell borders.

Slide deck schema (lmpdf pptx)

Type / contextMethod signatureDescription
context pptx: PptxHostpptx.create(string) -> Pptx | pptx.inspect(string) -> string | pptx.to_markdown(string) -> string | pptx.sample_image(string) -> voidCreate a 16:9 PDF slide deck builder, inspect or extract Markdown from a PDF, or write a 64x64 sample PNG.
Pptxp.slide() -> Slide | p.theme(string, string, string, string) -> Pptx | p.markdown(string) -> Pptx | p.save() -> voidAdd a slide, configure theme palette (primary, accent, background, text), build slides from Markdown, or write the PDF deck.
Slides.title(string) | s.title_slide(string, string) | s.section_header(string, string, string) | s.two_content(string, string, string) -> SlideSet slide title or populate standard title, section-header, or two-column slide layouts.
Slides.text(float, float, float, float, string) | s.bullet(float, float, float, float, string) | s.hyperlink(float, float, float, float, string, string) -> SlidePlace a positioned text box, bullet box, or hyperlink at (x, y, w, h) on the 1280x720 canvas.
Slides.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) -> SlidePlace an image, filled rectangle, rounded rectangle, or ellipse at (x, y, w, h).
Slides.line(float, float, float, float, string, float) | s.arrow(float, float, float, float, string, float) -> SlideDraw a line or arrow from (x1, y1) to (x2, y2) with hex color and stroke width.
Slides.notes(string) | s.footer(string) | s.slide_number(bool) | s.transition(string) -> SlideAttach speaker notes, slide footer text, slide number display, or transition metadata.
Slides.table(float, float, float, float, int, int) -> PptxTableCreate a slide table at (x, y, w, h) with the given row and column counts.
Slides.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) -> SlideRender a bar, line, or pie chart at (x, y, w, h) on the slide.
PptxTablet.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) -> PptxTablePopulate and style 1-based slide table cells and header rows.

Standard lmcode_std_v3 catalog

Category or interfaceFunctions, types, or signaturesDescription
Strings, math, and filesstr_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_linesStandard string processing, numeric math, encoding, and UTF-8 file helpers.
Collections, JSON, and return framingIntList, 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_nullTyped containers, JSON parsing, template rendering, and structured LMCODE_RETURN payload builders.

Exit codes

Exit codePhaseMeaning
0successPDF rendering, dry validation, or inspection succeeded and emitted an LMCODE_RETURN frame.
2cliInvalid CLI argument, retired flag (such as --first or --last), or malformed invocation manifest (such as missing/non-boolean dry).
3load / runBytecode load failure, schema mismatch, VM runtime error, or html_doc / html_xml dry validation failure.
4appApplication, Typst layout, missing input file, or output path write failure.