| docx_to_pdf | R Documentation |
Converts a .docx file to PDF with LibreOffice, or with Microsoft Word
through the doconv package. LibreOffice is free and runs on all
platforms. Each call uses a fresh temporary LibreOffice profile, so it
works while a LibreOffice window is open and in parallel runs.
docx_to_pdf(
docx,
pdf = NULL,
engine = c("auto", "libreoffice", "word"),
overwrite = FALSE,
verbose = TRUE
)
docx |
Path to an existing |
pdf |
Path of the PDF to write. |
engine |
|
overwrite |
Overwrite an existing |
verbose |
Print progress messages? Default |
If LibreOffice is installed in an unusual place, set the option
convertxlsform.soffice or the environment variable
CONVERTXLSFORM_SOFFICE to the path of the soffice binary.
The path of the PDF, invisibly.
if (interactive() && has_libreoffice()) {
docx <- tempfile(fileext = ".docx")
doc <- officer::read_docx()
doc <- officer::body_add_par(doc, "Hello")
print(doc, target = docx)
pdf <- docx_to_pdf(docx, pdf = tempfile(fileext = ".pdf"))
file.exists(pdf)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.