R/pdf_to_emf.R

Defines functions pdf_to_emf

Documented in pdf_to_emf

#' Convert PDF to EMF
#'
#' Convert a PDF file to an EMF file. Requires \code{inkscape} command-line utility.
#'
#' The function creates an EMF file at the same location where the PDF is.
#'
#' @param filename A PDF file name or file path
#'
#' @return NULL
#'
#' @export
#'
#' @examples
#' \dontrun{
#' pdf_to_emf(filename = "~/test.pdf")
#' }

pdf_to_emf = function(filename) {
  input = normalizePath(filename)
  output = gsub("\\.pdf$", "\\.emf", input)
  expr = paste0("inkscape ", input," --export-type=emf -o ", output)
  system(expr)
}
michaeldorman/geobgu documentation built on Jan. 6, 2021, 3:57 p.m.