Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

115
Views
MDPDF: Markdown to PDF conversion with dynamic footer or header

I'm trying to do a markdown to pdf conversion with mdpdf.

Basic pdf creation works.

My problem is to add a footer (or header) with dynamic content, in this case, a date.

Here's my test.md:

# An MDPDF Test
- convert markdown (.md) to PDF

https://github.com/BlueHatbRit/mdpdf/blob/master/examples/footers/md-file.md

Here's my test_footer.html:

<script>
var dt = new Date();
document.getElementById("datetime").innerHTML = dt.toLocaleDateString();
</script>

<center style="font-size: 10px">
    <p>FOOTER with locale date: <span id="datetime"></span></p>
</center>

I then call in terminal:

mdpdf /Users/felix/test.md  --footer=/Users/felix/test_footer.html

The result is a pdf with the footer text correctly placed, but the actual date in the upper left corner and without localisation.

I saw that mdpdf could use a handlebars (.hbs) file to compile the dynamic content, but have no clue how to do that.

How to get the date into the footer?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!