Export Multiple Notes to PDF? Pandoc?

What is the best way to export multiple Markdown files in a folder to (individual) PDF files?

I installed pandoc but I can’t figure out how to:

a) export multiple files to multiple PDF files. The manual seems to focus on merging multiple Markdown files into a single PDF file.

b) keep the same file name - input to output.

1 Like

You can use variables to do bulk conversion — example here.

Tried using this command

for i in *.md; do pandoc "$i" -t context -o "${i%.md}.pdf"; done 

Result:

pandoc(2911,0x20a683e00) malloc: can't allocate region
:*** mach_vm_map(size=1048576, flags: 100) failed (error code=268435465)
pandoc(2911,0x20a683e00) malloc: *** set a breakpoint in malloc_error_break to debug
pandoc: context: createProcess: runInteractiveProcess: exec: resource exhausted (Cannot allocate memory)
pandoc(2914,0x20795ee00) malloc: can't allocate region
:*** mach_vm_map(size=1048576, flags: 100) failed (error code=268435465)
pandoc(2914,0x20795ee00) malloc: *** set a breakpoint in malloc_error_break to debug
pandoc: context: createProcess: runInteractiveProcess: exec: resource exhausted (Cannot allocate memory)

Looks like the error that I am running into is related to pandoc and M1 MacBook Air

https://groups.google.com/g/pandoc-discuss/c/tWWIEgW94U0/m/yKMfldtYBgAJ

1 Like

For M1 Macs, this works

for f in *.md; do pandoc --pdf-engine=/Library/TeX/texbin/pdflatex "$f" -s -o "${f%.txt}.pdf"; done 

Source: https://groups.google.com/g/pandoc-discuss/c/tWWIEgW94U0/m/HyJ7IqX2BgAJ

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.