Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

docx2pdf

Convert docx to pdf


Description

Convert docx to pdf directly using "Microsoft Word". This function will not work if "Microsoft Word" is not available on your machine.

On Windows, this is implemented via win32com while on macOS this is implemented via JXA (Javascript for Automation, aka AppleScript in JS).

This is a simple call to python module 'docx2pdf'.

Usage

docx2pdf(input, output = gsub("\\.docx$", ".pdf", input))

Arguments

input, output

file input and optional file output (default to input with pdf extension).

Value

the name of the produced pdf (the same value as output)

See Also

Other tools for docx2pdf: docx2pdf_available(), docx2pdf_install(), docx2pdf_uninstall()

Examples

library(locatexec)
if (exec_available('python') && docx2pdf_available()) {
  file <- system.file(package = "doconv",
    "doc-examples/example.docx")

  out <- docx2pdf(input = file,
    output = tempfile(fileext = ".pdf"))

  if (file.exists(out)) {
    message(basename(out), " is existing now.")
  }
}

doconv

Document Conversion to 'PDF' or 'PNG'

v0.1.2
MIT + file LICENSE
Authors
David Gohel [aut, cre], ArData [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.