Mdexport is CLI tool to publish Markdown files as PDF using Jinja2 templates. You can use Frontmatter metadata as custom values to be filled into your template.
Create a directory where you will store your templates. Each template should be a subdirectory named with the desired template name.
Write your Markdown file. Provide Frontmatter metadata(compatible with Obsidian properties) as the keys that shall be rendered in your template.
Mdexport makes use of Weasyprint to generate PDF files. Installation of Weasyprint seems to be not straight forward on some systems. If you encounter issues please follow the steps in the link below.