简体   繁体   English

如何在Markdown中为PDF文档添加图像作为页眉/页脚

[英]How to add an image as a header/footer in Markdown for a PDF document

I want to add images as headers and footers (in keeping with my organizations visual identity) to PDF reports. 我想将图像添加为页眉和页脚(与我的组织视觉识别一致)到PDF报告。 I've managed to do it in Sweave but I'd also like to be able to do it using just Markdown. 我已经设法在Sweave中做到了,但我也希望能够使用Markdown来做到这一点。 I can insert the image using ![footer](H:/R/Footer.pdf) however when I try to use the wallpaper package (like I do in Sweave) I get an error. 我可以使用![footer](H:/R/Footer.pdf)插入图像但是当我尝试使用壁纸包时(就像我在Sweave中一样)我收到错误。

---
title: "2014 Report"
author: "My Name"
date: "Monday, October 06, 2014"
output:
  pdf_document:
    number_sections: yes
    toc: yes
fontsize: 10pt
header-includes:
    - \usepackage{wallpaper}
abstract: This is my abstract
---
\LRCornerWallPaper{0.99}{![footer](H:/R/Footer.pdf)} 

Is there a way in Markdown, or do I need to stick to Sweave? Markdown有办法,还是我需要坚持Sweave?

在这种情况下, wallpaper包的正确用法将是简单的

\LRCornerWallPaper{0.99}{path/to/pic}
---
header-includes:
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \setlength\headheight{45pt}
- \fancyhead{\includegraphics{header.jpg}}
- \setlength\footskip{5pt}
- \fancyfoot{\includegraphics{footer.jpg}}
output: 
  pdf_document:
   fig_caption: false

---

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM