title: How to download pdf automatically with an url
body: <p>I am using Ruby2.6.0, Rails5.2.3 and Kibana6.6.1. </p>
  
  <p>I need some help to realise pdf download automatically. Is there any way to download pdf/png automatically using the following url in controller? 'automatically' means users won't feel the file download and don't need to click download icon. </p>
  
  <p><a href="http://localhost:5601/api/reporting/jobs/download/jvhs9dga06559d006260ms70" rel="nofollow noreferrer">http://localhost:5601/api/reporting/jobs/download/jvhs9dga06559d006260ms70</a></p>
  
  <p>Edit:
  Add the code I tried. It helps me to download a file. But I cannot open it with Chrome or sublime. It seems like the file is related to kibana Chromium sandbox (<a href="https://www.elastic.co/guide/en/kibana/current/reporting-chromium-sandbox.html" rel="nofollow noreferrer">https://www.elastic.co/guide/en/kibana/current/reporting-chromium-sandbox.html</a>). Is anybody know what type of this download file is and how to open it? How to save it as pdf/png file in my local folder?</p>
  
  <pre><code> File.open('./public/testfile.png', "wb") do |file|
    file.write open("http://localhost:5601/api/reporting/jobs/download/jvhs9dga06559d006260ms70")
   end
  </code></pre>