【发布时间】:2020-08-06 13:12:56
【问题描述】:
我正在创建一份调查问卷,并希望让用户将结果保存为pdf。
html 看起来不错!但是printing 裁剪了图像,到目前为止没有任何效果。
编辑:我添加了一个关于pagedown包的合适quote,可能描述了问题:
"[...] 尝试从您的 Rmarkdown 文件之一生成 PDF,并通过 PDF 我的意思是那种将图像分解成注释的文档 从一页到另一页的一半,书面文本没有结束 页面的…(是的,我知道你知道我的意思,但是…)”
# YAML
---
output:
pdf_document: #html?
fig_crop: false # doesn't work
---
---
output:
pagedown::html_paged: # doesn't work
css: ["default-fonts", "default-page", "default"]
---
# CSS line-breaks
<style media="print">
html, body, p, hr, img {
break-after: avoid !important; # doesn't work
break-before: avoid !important; # doesn't work
break-inside: always !important; # doesn't work
}
</style>
# Button
<input type="button" value="Print this page" onClick="window.print()">
# Example Plot
```{r echo=FALSE, message=FALSE}
library(ggplot2)
Plot <- ggplot(mpg, aes(displ, cty)) + geom_point()
Plot + facet_grid(rows = vars(drv))
plot.height <- 45
```
# Calling the plot (with fig.height)
```{r, fig.height=plot.height, strip.white = TRUE} # doesn't work
plot(Plot)
```
这是实现的示例: https://exampleruntest.formr.org 由于某种原因,示例情节没有在情节之前引入换行符,而是在之后。
我希望有人有想法
【问题讨论】:
-
你试过
pagedown这个包了吗? -
不,但看起来很有希望!我试试看
标签: r r-markdown knitr