Search code examples
rreportreporters

Writing doc output to pdf


Hello fellow R enthusiasts,

I am wondering whether we can create a pdf version from docx within R (not using other conversion tools). I create a docx report using ReporteRs package. I would like to make a copy of that in pdf copy. Is it possible within R, without using any external softwares? Thank you in advance.


Solution

  • Here is one way to do it. Disclaimer: This answer came up in google group of ReporteRs.

    writeDoc( doc, file = docfile)
    system(paste("libreoffice --headless --convert-to pdf  ", docfile), intern = TRUE)
    

    It needs libreoffice application to be installed in your system.