cakebake / markdown-themeable-pdf

ARCHIVED. NOT MAINTAINED. Themeable Markdown Converter (Print to PDF, HTML, JPEG or PNG)
https://atom.io/packages/markdown-themeable-pdf
133 stars 37 forks source link

Pictures won't load / are not included in exported PDF #41

Closed Levanth closed 3 years ago

Levanth commented 8 years ago

Hello I trying to convert a Markdown with images into a PDF and also included an image in the header.js but it won't load the picture. The Text converts fine but no pictures. It worked till the last update...

I tried moving the pictures to the 'markdown-themeable-pdf' folder in .atom and in my project-folder everywhere they won't show up

cakebake commented 8 years ago

I test your problem at the next update. Do you have an example code?

Levanth commented 8 years ago

I used ![local image](picture.png) in the md file and my header content was:

contents: '<div style="text-align: right;">Header test <img src="test.png" width="48px" height="48px" /></div>'

It included the Pictures before, but after the update it won't include them into the pdf

IreneCrisologo commented 8 years ago

+1 for this bug report.

I am also trying to convert a Markdown with images to PDF, but the images don't show up in the PDF as I want them to. The tables render beautifully, though. :)

Here's what I observed in trying to add images.

  1. When the image is in the same folder as the markdown file, the images appear fine in the PDF. However, the caption disappears in the PDF.
  2. If I place the image within html tags, it still loads, but again without caption. Also the html tag doesn't work, the image is not centered.
  3. If the image is not in the same folder as the Markdown file but I provide the full path to the image, it would not load. There is a small box though, so it recognizes that an image should be there, but the script just doesn't see it.
  4. Combining tags and full path also doesn't make the image magically appear :\

Code: image

PDF: image

cakebake commented 8 years ago

I have made tests with following files.

Filenames with whitespaces and specialchars (escaped with <file name.png> doesn´t work after the update, but this is markdown-it package related and I could not do here anything. Could you please send me an ZIP archive to reproduce your problems?

@irenemeanspeace HTML around markdown code does not work. #47

robotroll commented 8 years ago

The main problem seems to be when there is a relative or absolute path used to point to the location of the image

![ImageInSameFolder](testPicture.jpg)
![ImageRelative](../Logo/testPicture.jpg)
![ImageAbsolute](c:\Data\Logo\testPicture.jpg)

Only the first one is working for me in the PDF, HTML or pictures. Relative and absolute are not shown. All of them are working fine in the makdown-preview-plus preview and the exported HTML from it.

The same also applies for the header.js file

contents: '<img src="testPicture.jpg" alt="Test Logo">'
contents: '<img src="../Logo/testPicture.jpg" alt="Test Logo">'
contents: '<img src="c:\Data\Logo\testPicture.jpg" alt="Test Logo">'

For the header.js file the image must exist in the same folder: c:\Users\username.atom\markdown-themeable-pdf

cakebake commented 8 years ago

Ok, I will test it again. You are on a windows machine?

IreneCrisologo commented 8 years ago

@cakebake thanks for the update and response! I understand the issue about the html tags, guess there's no way around that.

However, is there a way to include the caption (the text inside the brackets) in the PDF?

I am on a windows machine, and the relative path seems to work for me. It should be ./Logo/testPicture.jpg (one dot) instead of ../Logo/testPicture.jpg (two dots), then it works. @robotroll But yes still the absolute path doesn't seem to work.

robotroll commented 8 years ago

@irenemeanspeace Thanks for the tip with the single dot. @cakebake Yes, I'm on a Windows machine.

cakebake commented 8 years ago

@irenemeanspeace What do you exactly mean with

... is there a way to include the caption (the text inside the brackets) in the PDF

Do you mean the "alt="*"" Tag visible as image caption? Some Text placed under the image to describe it?

IreneCrisologo commented 8 years ago

@cakebake Yup, usually the text within the brackets appears as a caption below the image ![caption](filename.jpg)

aguadopd commented 7 years ago

I second @IreneCrisologo 's motion for the captions below the image. Thanks for the great package. Arrived here because image was not being included in PDF and ... well, filename had a space. Erased the space and problem is solved.

simonmcl commented 7 years ago

This issue is also affecting me. Bit of a pain to have to keep all my images in the same directory as the markdown document. Any update on this?

ylawayjdp commented 6 years ago

I have this problem but have got around it by inserting html where I would use the markdown image syntax.

cakebake commented 3 years ago

Hello, sorry, but I will no longer maintain the project.

This project is archived because the owner no longer uses the Atom Editor.

It would be very good to find a new owner for this project, who will take care of updating and expanding the Atom package. A new version based on Chrome Headless has already been prepared in a feature branch.