title: R: download pdf embedded in a webpage
body: <p>Trying to find an easier way to grab the table in the pdf embedded in this <a href="http://www.dmo.gov.uk/ceLogon.aspx?page=about&amp;rptCode=D10A" rel="nofollow">page</a> or even better, download this pdf into a local drive:</p>
  
  <p>My code is below and results are messy... </p>
  
  <p>PS: none of the buttons at the bottom of the webpage works unless you use IE, and IE with RSelenium... I have created a code to load the page on IE, can successfully click on any of the buttons to either load the excel file (stuck at the step where it pops up a window to ask me to open or save) or open the pdf on the current window, but same problem, don't know how to grab the pdf. So dead ends everywhere.</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>library(RSelenium)
  checkForServer()
  startServer()
  remDr&lt;-remoteDriver$new()
  url&lt;-"http://www.dmo.gov.uk/ceLogon.aspx?page=about&amp;rptCode=D10A"
  remDr$open(silent = TRUE) #opens a browser
  remDr$navigate(url)
  doc &lt;- htmlParse(remDr$getPageSource()[[1]])
  
  table &lt;- readHTMLTable(doc, header=NA, stringsAsFactors=TRUE) 
  </code></pre>