iframe in html output, but clickable image in pdf?

I want my Quarto document to do different things depending on if I render to html or pdf:

  • For html output I want to display an iframe (containing an interactive observable widget)
  • For pdf output I want instead to display an image that is clickable and leads to a website.

I want to be able to render to both formats automatically from the same quarto file, so I must add this programmatically in the quarto file.

Is this possible?

Thanks!

Are you using Knitr engine or Jupyter output ?

With knitr you can do conditional based on format using R:

With Quarto you can conditionally include content using blocks: Quarto – Conditional Content

based on that, you can insert what you expect for each format you target. I don't know how you do a clickable image in PDF though using LaTeX. You would need to find that.

1 Like

Thanks, the conditional Quarto options is what I was looking for.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.