quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.97k stars 328 forks source link

background image in pptx render not found #5498

Open anielsen001 opened 1 year ago

anielsen001 commented 1 year ago

Bug description

I tried to render a reveal.js presentation into pptx instead and found an error. I created a repo to demo the error here: https://github.com/anielsen001/quarot-pptx-bug-000.

The problem is that I have a background-image on a slide like this:

## Quarto {background-image="/img/quarto.png" background-size="contain" background-opacity=0.1}

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see <https://quarto.org>.

The reveal.js render works fine, but when rendering to pptx, it cannot find the image, and i get this error message:

pandoc 
  to: revealjs
  output-file: pptx-bug-1.html
  standalone: true
  wrap: none
  default-image-extension: png
  html-math-method:
    method: mathjax
    url: >-
      https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML-full
  slide-level: 2

metadata
  link-citations: true
  width: 1050
  height: 700
  margin: 0.1
  center: false
  navigationMode: linear
  controlsLayout: edges
  controlsTutorial: false
  hash: true
  history: true
  hashOneBasedIndex: false
  fragmentInURL: false
  transition: none
  backgroundTransition: none
  pdfSeparateFragments: false
  lang: en
  auto-stretch: true
  title: pptx-bug-1

pandoc 
  to: pptx
  output-file: pptx-bug-1.pptx
  default-image-extension: png

metadata
  title: pptx-bug-1

pandoc: /img/quarto.png: withBinaryFile: does not exist (No such file or directory)

I believe it has to do with how I specify the path to the background image, but it works for reveal.js. I'm not sure how to specify it for pptx rendering. I think that the syntax for one should work for both. I'd like to be able to simply add a new type of output and have my existing content just work.

I'm using quarto version 1.3.340 on the command line, on Ubuntu 20.04. here's the output of quarto check:

07:00 $ quarto check

[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.340
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.8.3
      Path: /home/apn/sw/bin/python3
      Jupyter: 4.10.0
      Kernels: julia-1.8, python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.2.3
      Path: /usr/lib/R
      LibPaths:
        - /home/apn/R/x86_64-pc-linux-gnu-library/4.2
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.42
      rmarkdown: 2.20

[✓] Checking Knitr engine render......OK

Checklist

mcanouil commented 1 year ago

Simply remove the leading / which is not read as root of the project for PowerPoint format it seems.

cscheid commented 1 year ago

This is definitely a bug on our side. We should be looking into that path for project-relative path fixups and are apparently not.

anielsen001 commented 1 year ago

Simply remove the leading / which is not read as root of the project for PowerPoint format it seems.

This does work, but only in this case where the relative path to the qmd file makes sense. Especially for backgrounds and logos, I have a top-level directory with all the graphics and it's hard to specify where to find these from a relative path, especially if you move the markdown files around later to refactor the project.