Recently, I had to submit a document as either a DOCX (Microsoft Word’s format) or a PDF. I wasn’t going to use Word, and I don’t know LaTeX. So I had to get a little crafty with what I already know.
My initial thought was to use Markdown, but that made styling a pain, so I went with HTML and made up my own tags to keep it legible. Then I used CSS and @page to format it for print, like so:
<style>
@page {
size: A4;
margin: 0.5in;
}
</style>
After that I converted it to a PDF with:
ungoogled-chromium --headless --no-pdf-header-footer --print-to-pdf="$HOME/Downloads/output.pdf" "file://$HOME/Downloads/input.html"
This also works with standard Chrome, Chromium, and maybe Brave. I don’t think Firefox can do this from the command line.
Both the input and output are in Downloads because that’s the only directory that web browsers can access by default on OpenBSD.
I hope this helps you avoid learning a new program and markup language too.