EvaMaeRey / xaringanPrinter

convert xaringan/remark.js slides to Xaringan
Other
7 stars 1 forks source link

slides_pdf() should not output "slides_combined.pdf" when only given one file as input #2

Open brshallo opened 3 years ago

brshallo commented 3 years ago

You might want to add a catch for pdf_combine() in the instance where there is only one file outputted. (Did not check locally) but I think currently this will output both a {input}.pdf as well as a "slides_combined.pdf" (regardless of length of {input}).

slides_pdf <- function(input){

  for (i in 1:length(input)){
pagedown::chrome_print(input = input[i])
  }

if(length(input == 1)) return() # new line

  pdftools::pdf_combine(input = stringr::str_replace(input, ".html", ".pdf"),
                        output = "slides_combined.pdf")

}

Let me know if you agree and I can open a PR for this.

EvaMaeRey commented 3 years ago

This sounds good to me. PR welcome.