# Plotly graph into PDF markdown

**URL:** <https://community.plotly.com/t/plotly-graph-into-pdf-markdown/3586>\
**Category:** Plotly R\
**Created:** [March 8, 2017, 2:56am UTC](https://community.plotly.com/t/plotly-graph-into-pdf-markdown/3586 "2017-03-08T02:56:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.baillargeon](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@thomas.baillargeon](https://community.plotly.com/u/thomas.baillargeon)\
**Post date:** [March 8, 2017, 2:56am UTC](https://community.plotly.com/t/plotly-graph-into-pdf-markdown/3586/1 "2017-03-08T02:56:09Z")

</div>

Hi there,

I am trying to knit a rmarkdown document into PDF but I get this error message :

```auto
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:

  always_allow_html: yes

```

but when I add this option into the YAML nothing change.

```auto
output:

  pdf_document:
  always_allow_html: yes

```

I still get the same error. Is there a way to use plot\_ly and knit the graph into PDF ?

Here is my code :

````auto
``` {r,echo=FALSE, fig.height=4.3 , fig.width=8, error=FALSE, warning=FALSE, message=FALSE}
library(plotly)

plot_ly(x=GDP_CAN$Annee,y=GDP_CAN$Valeurs,type="l")
layout(xaxis=list(title="Année"),yaxis=list(title="Dollard US / Capital")) ```

````

---

<div class="post-metadata">

**Author:** ![carlosahz21](https://avatars.discourse-cdn.com/v4/letter/c/c4cdca/32.png) [@carlosahz21](https://community.plotly.com/u/carlosahz21)\
**Post date:** [April 6, 2020, 12:42pm UTC](https://community.plotly.com/t/plotly-graph-into-pdf-markdown/3586/2 "2020-04-06T12:42:56Z")

</div>

[https://stackoverflow.com/questions/42543206/r-markdown-compile-error](https://stackoverflow.com/questions/42543206/r-markdown-compile-error)
