Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(pdftools)
- office_shot <- function( file, wd = getwd() ){
- cmd_ <- sprintf(
- "/Applications/LibreOffice.app/Contents/MacOS/soffice --headless --convert-to pdf --outdir %s %s",
- wd, file )
- system(cmd_)
- pdf_file <- gsub("\.(docx|pptx)$", ".pdf", basename(file))
- pdf_file
- }
- office_shot(file = "your_presentation.pptx")
- library(RDCOMClient)
- file <- "C:/path/to your/doc.docx"
- wordApp <- COMCreate("Word.Application") #creates COM object
- wordApp[["Documents"]]$Open(Filename=file) #opens your docx in wordApp
- wordApp[["ActiveDocument"]]$SaveAs("C:/path/to your/doc.pdf"), FileFormat=17) #saves as PDF
- wordApp$Quit() #quits the COM Word application
Add Comment
Please, Sign In to add comment