I can't figure out why pdf images I'm inserting into my HTML RMarkdown document are appearing inside of itty bitty scroll boxes with both vertical and horizontal scrollbars. This doesn't happen if I convert the same image to .png
The pdf image appears this way if inserted like so:
```{r, echo=FALSE, eval = TRUE}
knitr::include_graphics("image.pdf")
```
or like so:
![](image.pdf)
I have an option set to include scroll bars in my code chunks, but if I remove it and re-knit the document the itty bitty image scroll box remains so this is not causing the problem (and is the only non-default setting):
```{css, echo=FALSE}
pre code, pre, code {
white-space: pre !important;
overflow-x: scroll !important;
word-break: keep-all !important;
word-wrap: initial !important;
}
```
Changing the option out.width = '100%'
is resizing the scrollbox a bit but not removing it. Note that the pdf image is 6 x 2.5 inches, so not unreasonably large or anything. Any ideas to make my inserted pdf image not be in a scroll box at all? Thanks!
I encountered the same problem, the only solution I found was to convert the image to another format (.png). That solved the issue for me, even though the quality of the graphics was reduced. I just took a screenshot of the pdf, pasted into Word and used "save as picture" from Word.