yzane / vscode-markdown-pdf

Markdown converter for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
Other
1.01k stars 206 forks source link

Header or footer image #191

Open lewandowski77 opened 4 years ago

lewandowski77 commented 4 years ago

I tried to generate PDF file with image in header but this option doesn't work. Can you put some examples how to put img from http:// address?

jnstllng commented 2 years ago

Since Atom will be sunsetting soon, I converted to VS Code and try to use it as my primary markdown note taking tool. It works well, only the pdf export does not work as I would like to have it. As described here, this is what I need: https://github.com/cakebake/markdown-themeable-pdf The Atom package (already archived for some time) allows exactly the described function. Is it possible to adapt this package accordingly?

This is also described in this post: https://github.com/yzane/vscode-markdown-pdf/issues/59#issue-297822871

beerdog commented 1 year ago

I too had some trouble with this. The workaround that worked for me was to inactivate the header and position a certain img-element instead. And to be able to specify a particular img-element i identify it by the title attribute. This is not a perfect solution, as it will only show on the first page, but it's enough for me.

In my "markdown-pdf.css":

img[title="logo"] {
    height: 80px;
    width: auto;
    position: relative;
    top: -1em;
    right: -46em;
    margin-bottom: -4em;
}

In my markdown file: ![alt text](assets/logo.png "logo") My settings.json:

{
  "markdown-pdf.displayHeaderFooter": false,
  "markdown-pdf.margin.top": "0cm",
  "markdown-pdf.styles": [
    "markdown-pdf.css",
  ],
}