openPDF: open PDF file with sumatra viewer

View source: R/openPDF.R

openPDFR Documentation

open PDF file with sumatra viewer

Description

open PDF file with SumatraPDF viewer, which does not lock files against being edited. It is only available on windows, but comes bundled with Rstudio. If the executable is not found, openFile is called instead.
I suggest to first change some settings with sumatraInitialize().

Usage

openPDF(
  file,
  rspath = sub("rstudio.exe$", "", Sys.getenv("RSTUDIO_DESKTOP_EXE")),
  sumexe = NULL,
  ...
)

Arguments

file

Filename to be opened, as character string. Files not ending in ".pdf" are ignored with a warning.

rspath

The path to Rstudio files. DEFAULT: sub("rstudio.exe$", "", Sys.getenv("RSTUDIO_DESKTOP_EXE"))

sumexe

The path to SumatraPDF.exe. DEFAULT: Null: added to rspath, e.g. "C:/Program Files/RStudio/resources/app/bin/sumatra/SumatraPDF.exe"

...

Further arguments passed to system

Value

Result of try(system, ...), invisibly

Author(s)

Berry Boessenkool, berry-b@gmx.de, May 2020

See Also

openFile for the default opening programm
sumatraInitialize for nice Sumatra default settings
pdfpng to create PDFs and PNGs simultaneously.

Examples

# only desired in an interactive session, not on CRAN checks
# openPDF( system.file("extdata/Anhang.pdf", package="berryFunctions")  )
# openPDF( system.file(c("extdata/Anhang.pdf", "extdata/RainfallStationsMap.pdf"), 
#                      package="berryFunctions")  )


berryFunctions documentation built on May 29, 2024, 4:01 a.m.