I can open a webpage from R:
shell.exec("http://stackoverflow.com/")
But how can I then print this web page, directly from R, as an xps or pdf file?
You can call the wkhtmltopdf command-line tool , which is open source and cross-platform:
shell("C:\\wkhtmltopdf\\bin\\wkhtmltopdf http://stackoverflow.com so.pdf")
Remember to avoid backslashes!