Skip to content

How to include a figure in PDF format? #11361

Answered by roaldarbol
roaldarbol asked this question in Q&A
Discussion options

You must be logged in to vote

Ended up creating a Lua filter which converts PDF files to .webp format with some help from ChatGPT, which does this quite nicely. You can tweak the imagemagick settings a to your liking.

pdf-to-webp.lua, which I've for now just placed in the base of my workspace:

  1. Converts .pdf to .webp in the source folder.
  2. Except if a webp file is already generated
  3. Checks whether the source .pdf file has changed, in which case it re-converts

EDIT: I've made the filter into an extension which can be found here: https://github.com/roaldarbol/pdf-to-image


-- Lua filter for Quarto to convert PDF images to WebP only in HTML output

-- Check if the current output format is HTML
local is_html = (quarto and q…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
5 replies
@roaldarbol
Comment options

@mcanouil
Comment options

@roaldarbol
Comment options

@mcanouil
Comment options

@roaldarbol
Comment options

Comment options

You must be logged in to vote
2 replies
@mcanouil
Comment options

@roaldarbol
Comment options

Answer selected by roaldarbol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
figures html Issues with HTML and related web technology (html/css/scss) lua Issues related to the lua codebase, filter chain, etc
2 participants