Stitch together Markdown, images, and PDFs into a single printable PDF suitable for submissions, reports, and archives. Write content using familiar Markdown syntax and the tool will render the document, embed external PDFs, inline images when possible, and produce a final PDF ready for distribution.
Author documents in any text editor or generate content with an LLM — the workflow stays the same: write Markdown, reference assets, and let the tool assemble the final PDF.
Use LaTeX-style math expressions that will be rendered using MathJax:
Inline math: $E = mc^2$
Display math:
$$\int_{-\infty}^\infty e^{-x^2} dx = \sqrt{\pi}$$Include images with custom sizes:
Insert page breaks using:
\pagebreakEmbed PDFs that will be included in the final output:
You can control which pages from an embedded PDF are included using simple operators in the image alt text. Page numbers are 1-indexed.
- Skip pages: use
!=followed by a comma-separated list of page numbers to exclude those pages. Example:
- Include pages: use
=followed by a comma-separated list of page numbers to include only those pages. Example:
You cannot specify both != and = for the same PDF (the tool will throw an error).
Customize the appearance of your generated PDFs by providing a custom CSS file:
document-stitcher input.md output.pdf --theme custom-theme.cssThe CSS file will be applied to the HTML before PDF generation, giving you full control over fonts, colors, spacing, and layout. See test_theme.scss for an example of a colorful theme.
Here are some example PDFs generated from the test fixtures:
- Basic Markdown - Simple markdown rendering
- Combined Features - Multiple markdown features
- Embedded PDFs - PDF embedding functionality
- Images - Image inclusion and sizing
- Math Expressions - LaTeX math rendering
- Multi-page PDFs - Full PDF embedding
- Page Selection - Selective page inclusion
- Page Skipping - Page exclusion
- Page Breaks - Manual page breaks
- Custom Theme - Colorful themed output
This project is licensed under the ISC License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.