PDF Generation Error with Image Paths in Quarto #11959
Replies: 2 comments 1 reply
-
Could you share a small self-contained "working" (reproducible) example to work with, i.e., a complete Quarto document or a Git repository? The goal is to make it as easy as possible for us to recreate your problem so that we can fix it: please help us help you! Thanks. You can share a self-contained "working" (reproducible) Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four If you have multiple files (and if it is absolutely required to have multiple files), please share as a Git repository.
Additionally and if not already given, please share the output of |
Beta Was this translation helpful? Give feedback.
-
I confirm image paths are broken when trying to render PDF from a book project. Example image paths that work for the website include:
However neither of these paths are valid for the PDF.
I wonder what path would work for both the website and the PDF generation process. |
Beta Was this translation helpful? Give feedback.
-
Description
Quarto version: 1.6.39
Operating system: windows 11 pro
I’m automating PDF generation for our SOPs in an MKDocs project using Quarto. (python automation)
The project directory structure looks like this:
guidelines
└── docs/
└── mutiple_sub_dirs/
└── img/
└── sop/
├── supplements/
└── SOP_pdfs/
The PDF is generated from a merged.qmd file that combines multiple .md files from different directories. Some .qmd files reference images with paths like:
Working example: [../../img/Data.png]
Problematic example: [../../../img/Data_img.png]
Issue:
When generating the PDF, I encounter the following error for image paths with three levels up (../../../):
Error running filter C:/Program Files/Quarto/share/filters/main.lua:
File ../../../img/Data.png not found in resource path
The .qmd files with shorter paths (e.g., [../../img/Data.png]) work fine.
When I changed the output directory to be a subdirectory of docs (e.g., SOP_pdfs moved out of supplements), the issue flipped:
Long paths like [../../../img/Data_img.png] started working.
Short paths like [../../img/Data.png] began failing.
Attempted Solution:
I tried using the --resource-path argument to explicitly define the img directory, but the issue persists
Question:
How can I configure Quarto to consistently resolve image paths regardless of the output directory location? Is there a way to set a universal base resource path or another method to avoid these path issues?
Beta Was this translation helpful? Give feedback.
All reactions