7  Embedding PDF files

There are two ways to embed PDF files in a Quarto page: by using native Quarto support, or with the embedpdf extension.

Warning

This is useful only for HTML/webpage output, and embedding PDFs will not render as expected in Word document or other outputs.

7.1 Native embedding

PDF files can be embedded in Quarto using the standard link syntax:

![An example PDF document](example.pdf)

Kiepas et al. (2024)
![Kiepas _et al._ (2024)](assets/papers/kiepas_et_al_2024.pdf)

7.1.1 Controlling embedded document size

To set the height and width of the presentation of the embedded document, use brace notation:

![An example PDF document](example.pdf){width=80% height=300px}

Kiepas et al. (2024)
![Kiepas _et al._ (2024)](assets/papers/kiepas_et_al_2024.pdf){width=100% height=300px}

7.2 embedpdf

embedpdf is a Quarto extension that enables embedding of PDF files directly into Quarto HTML files. The extension is included as part of this template.

With embedpdf, files are embedded using shortcodes, e.g.:

{{< pdf example.pdf >}}
{{< pdf assets/papers/kiepas_et_al_2024.pdf >}}

7.2.1 Controlling embedded document size

To set the height and width of the presentation of the embedded document, add these variables to the shortcode:

{{< pdf example.pdf height=200px width=80%>}}
{{< pdf assets/papers/kiepas_et_al_2024.pdf height=300px width=100% >}}

7.2.2 Installing embedpdf

The extension is packaged as part of this template, but if you do need to install embedpdf in other Quarto projects, use the command:

quarto add jmgirard/embedpdf