4

It is currently possible to insert a PDF as an image in markdown files through pandoc by doing this:

# Hello World
![My PDF file inserted](my-pdf.pdf)

Then you convert that markdown file with pandoc:

~$ pandoc -s -f markdown-implicit_figures my-document.md -o my-document.pdf

And it works! But pandoc only inserts the first page of my-pdf.pdf.

Is it possible to set which page to insert, or better, which pages range?

Thanks by advance.

Creasixtine
  • 771
  • 6
  • 6
  • 1
    not really an answer (i don't know if pandoc can do what you want or not), but as a last resort, `pdfseparate` from poppler-utils can split a multi-page PDF into multiple PDF files. You could then include the specific pages you wanted. – cas Apr 05 '21 at 12:23
  • Absolutely, you can also extract one specific page with `pdftk`. – Creasixtine Apr 05 '21 at 16:48

1 Answers1

2

Unfortunately, as far as I know, there are only two options:

  • Split the pdf in multiple 1-page documents p1.pdf, p2.pdf, etc., and insert them with
![](p1.pdf)
![](p2.pdf)
  • Use
\includepdf[pages=-]{myfile.pdf}

But this works only if you output tex or pdf documents.

You may find this discussion useful.

Clément
  • 288
  • 1
  • 7
  • 20