Skip to content

Reversible PDFs

mkuch edited this page Jul 13, 2026 · 1 revision

Reversible PDFs

RayoMD can optionally embed the exact Markdown source in a PDF using the rayomd-source/1 PDF 2.0 profile. Ordinary exports do not embed source.

rayomd --export input.md reversible.pdf native elegant normal --embed-source
rayomd --inspect-source reversible.pdf
rayomd --recover-source reversible.pdf recovered.md

--inspect-source validates the profile without writing. --recover-source checks the profile, attachment relationship, size, UTF-8, length, and SHA-256 digest before atomically writing byte-exact Markdown.

Privacy and limits

Embedding exposes the complete Markdown source to anyone who receives the PDF, including comments, link destinations, image paths, reference definitions, and other content not visible on rendered pages. Leave it disabled unless exact recovery is wanted.

  • Embedded source must be valid UTF-8 and no larger than 10 MiB.
  • Recovery rejects PDFs larger than 256 MiB and malformed or ambiguous profiles.
  • Existing recovery destinations are not overwritten.
  • Recovery never falls back to heuristic PDF-to-Markdown conversion.
  • UTF-8 BOMs and embedded NUL bytes survive exact recovery.

The source is stored uncompressed so the lightweight Windows and Linux packages remain mutually compatible without adding a mandatory compression dependency. The version-specific object contract and hostile-input rules remain canonical in docs/development/reversible_pdf_profile.md.

Clone this wiki locally