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

Images don't appeared in exported PDF #64

Closed
reparke opened this issue Aug 13, 2019 · 8 comments
Closed

Images don't appeared in exported PDF #64

reparke opened this issue Aug 13, 2019 · 8 comments

Comments

@reparke
Copy link

reparke commented Aug 13, 2019

When I previews slides in VSCode and when I exported them to HTML, the images appear. However, when I export the same file to PDF, the images don't are missing.

Here is my code (I tried both HTML and standard markdown)
<img src="assets/potentiometer-482082_960_720.jpg" style="width:50px" /> ![width:300px](assets/1565313673103.png)

Here is the PDF export with the missing images
image

For comparison, here is the preview from VSCode with the images present
image

@yhatt
Copy link
Member

yhatt commented Aug 14, 2019

Marp for VS Code should allow rendering local images by default, so I cannot reproduce reported issue on my macOS.

Would you provide us more details? e.g. OS environment, versions of VS Code and extension, the file tree structure on your project workspace, console outputs by Marp CLI after exporting PDF (in Help -> Toggle Developer Tools), etc...

@reparke
Copy link
Author

reparke commented Aug 15, 2019

Certainly.
OS: Windows 10 Pro version 1803 (build 17134.885)
VSCode: 1.37.0
Marp extension: 0.8.1
File tree structure: C:\Users\Rob\Dropbox (uscitp)_ITP 348_Content (public)_lectures_week3\filename.md

Console output:
image
image
image
image

@yhatt
Copy link
Member

yhatt commented Aug 16, 2019

Thanks. Marp CLI warnings are giving me the thing that something is wrong. (Typically local file accessing is enabled and blocked by security reason never output together)

I'll try to find the details of cause. As a workaround, you might export to HTML once, and convert from HTML to PDF by printing out with Chrome (Ctrl+P).

@reparke
Copy link
Author

reparke commented Aug 16, 2019 via email

@yhatt
Copy link
Member

yhatt commented Aug 23, 2019

I've confirmed this problem is fixed in the latest v0.8.2. (Please re-open the issue if still reproduces)

v0.8.1

v0.8.1

v0.8.2

v0.8.2

@eric-burel
Copy link
Contributor

eric-burel commented Mar 8, 2021

Hi, I am encountering this issue in v0.17.2 when exporting to PDF with VS Code (Ubuntu), I did not manage to get more logs.

Exporting through the CLI in the terminal with --allow-local-files gets the image as expected but not the styles.
Edit: ./node_modules/.bin/marp my-slides.md --pdf --allow-local-files --theme-set ./themes/ gets the theme correclty so at least I can export through CLI

@jiewangjs
Copy link

I use typora to insert image in a global path fashion, then put the code in vscode to convert to pdf, vscode doesnt allow global path which I know, does this mean Marp cannot corectly export the image out to pdf too, or is there some workaround ?

@yhatt
Copy link
Member

yhatt commented May 28, 2021

@jiewangjs It's just following VS Code's restriction, not the limit by Marp: Sometimes using local files with global path become potentially security risk about resource sniffing so VS Code cannot preview images that are not placed in the current workspace.

You can opt in to use local resources freely by using Marp CLI --allow-local-files.
https://github.com/marp-team/marp-cli#security-about-local-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants