Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image attachment not shown when converting to PDF #1079

Closed
t-makaro opened this issue Aug 1, 2019 · 12 comments
Closed

Image attachment not shown when converting to PDF #1079

t-makaro opened this issue Aug 1, 2019 · 12 comments
Labels
format:PDF pertains to exporting to the PDF format

Comments

@t-makaro
Copy link
Contributor

t-makaro commented Aug 1, 2019

image_test.ipynb.zip

Running Jupyter nbconvert --to pdf image_test.ipynb on a notebook with an attachment ![image.png](attachment:image.png), the resulting image is not shown. Similar too #699.

In nbconvert 5.5 a pdf is still produced, after #1053 this throws an error.

@t-makaro t-makaro added the format:PDF pertains to exporting to the PDF format label Aug 1, 2019
@ghayth82
Copy link

ghayth82 commented Mar 4, 2020

I am facing the same issue, any solution or workaround?

@alelom
Copy link

alelom commented Mar 11, 2020

Also by doing this in a Markdown cell:

\begin{figure}[h!]
\includegraphics{myImage.png}
\end{figure}

the exported PDF does not show any image, but an empty blank space instead, by the look of it exactly of the size of the image.

@tashrifbillah
Copy link

Okay folks--finding no other way, I ended up breaking down my markdown cells as markdown--python--markdown cells with the middle one as:

from IPython.display import display, Image
display(Image(filename="a.png", height=400, width=400))

Now jupyter-nbconvert --to PDFviaHTML notebook.ipynb properly converts to notebook.pdf.

bilke added a commit to ufz/ogs that referenced this issue Apr 1, 2022
Please use regular image syntax in Markdown.

attachment:-syntax seems not supported by nbconvert:

jupyter/nbconvert#1079
@khurchla
Copy link

khurchla commented Jun 9, 2022

Struggling with this to brand jupyter notebook output with a logo

@zachbellay
Copy link

@tashrifbillah Thank you for your solution! This worked for me. Hopefully this is resolved soon as this is a pretty common use case.

@joernhees
Copy link

i don't think this is a PDF exporting issue only, for me HTML export with images that were pasted into markdown (attached to cell metadata) also doesn't work...

from what i can tell this seems related to #1057 and seems to have been fixed after #699, #780, #980 ...
is this maybe a regression?

@tuncbkose
Copy link
Contributor

Should be fixed with #1978. Please reopen if there are any issues

@normanius
Copy link

normanius commented Mar 5, 2024

I'm still facing this problem. Is this fix already released?

Inserting an image to a Markdown cell using either of the two following ways does not work

![Circadian rhythm](../data/doc/circadian-rhythm-collage.jpg)
<img src="./data/doc/circadian-rhythm-collage.jpg" alt = "Circadian rhythm">

Also dropping the image into the same folder as the notebook (to avoid the need of a relative paths) doesn't help.

See how the result is displayed:

image

I convert the Jupyter notebook using the following command:

jupyter nbconvert --to pdfviahtml file.ipynb

I'm running the following versions (no idea what is really relevant):

  • Python 3.10.5
  • Jupyter 1.0.0
  • nbconvert 7.16.2
  • nbclient 0.9.0
  • nbclassic 1.0.0
  • nbformat 5.9.2
  • notebook 7.1.1
  • notebook-as-pdf 0.5.0

@tuncbkose
Copy link
Contributor

The fix above applies to PDF generation via LaTeX (--to pdf). Does that work for you?

I don't exactly remember the state of PDF via HTML because I didn't use it much. Also are your relative paths the same? You have both ./data/ and ../data/.

@normanius
Copy link

My bad, I was confusing those. With --to pdf it works.

Is that a known issue, or should I report the problem in a separate issue?

@tuncbkose
Copy link
Contributor

#1938 is the same issue, you could leave a comment/reaction if you'd like.

@normanius
Copy link

Okay. Thanks. Will do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format:PDF pertains to exporting to the PDF format
Projects
None yet
Development

No branches or pull requests

9 participants