daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Dec 18th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library(pdftools)
  2. office_shot <- function( file, wd = getwd() ){
  3.   cmd_ <- sprintf(
  4.     "/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf --outdir %s %s",
  5.     wd, file )
  6.   system(cmd_)
  7.  
  8.   pdf_file <- gsub("\.(docx|pptx)$", ".pdf", basename(file))
  9.   pdf_file
  10. }
  11. office_shot(file = "your_presentation.pptx")
  12.    
  13. library(RDCOMClient)
  14.  
  15. file <- "C:/path/to your/doc.docx"
  16. wordApp <- COMCreate("Word.Application") #creates COM object
  17. wordApp[["Documents"]]$Open(Filename=file) #opens your docx in wordApp
  18. wordApp[["ActiveDocument"]]$SaveAs("C:/path/to your/doc.pdf"), FileFormat=17) #saves as PDF
  19. wordApp$Quit() #quits the COM Word application
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top