title: Downloading a File from HapiJs Server
body: <p>I need a little help
  I want to generate a pdf report.</p>
  
  <p>I'm using PDFKit Node Module</p>
  
  <pre><code>const PDFDocument = require("pdfkit");
  
  function generatePDF(request, reply) {
    let doc = new PDFDocument();
     let path = __dirname + "/payments/" + "filename" + ".pdf";
  
  
  
    doc.text = "Hello World!";
    doc.text = "Hello Me!";
    doc.end();  
    return reply(doc)
         .header('Content-disposition', 'attachment; filename=' + 'payments.pdf')  
  
  }
  </code></pre>
  
  <p>On the client-side, I have tried so many things:</p>
  
  <p>1.</p>
  
  <pre><code>button.addEventListener("click", function (event) {
          axios.get('/payment-pdf')
              .then(function (response) {
                  console.log(response);
  
              })
              .catch(function (error) {
                  console.log(error);
              });
  
      }, false)
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>&lt;a href="/payment-pdf" download&gt;Export&lt;/a&gt;
  </code></pre>
  
  <p>How do I download the PDF file?
  It seems as a simpe task, but I'm not able to get it done.</p>
  
  <p>Thank you.</p>