title: Download Pdf which created using pdfkit library in nodejs through angular frontend
body: <pre><code>async createpdf(){
  
  const doc = new PDFDocument();
  
  doc.pipe(fs.createWriteStream('example.pdf'));
  
  // content of the pdf
  
  doc.end();
  }
  </code></pre>
  
  <p>I used the nodejs and angular for my project. In order to export pdf I used the pdfkit library and exported the pdf. But I need to download pdf when clicking the button in the angular frontend.
  Can you explain how to download the pdf when clicking the button in the angular front end?</p>
  
  <p>this is the code which i added in component.ts</p>
  
  <pre><code>exportToPdf(){
    this.classroomService.createpdf();
    this.subscription = this.classroomService.alertMessageOccured
    .subscribe((alert) =&gt; {
     if (alert.code == 200) {
      this.alertService.clear();
            this.alertService.success(alert.message);
  
  
          } else {
            this.alertService.clear();
            this.alertService.error(alert.message);
          }
   })
  }
  </code></pre>
  
  <p>This is the code of button</p>
  
  <pre><code> &lt;button class="btn btn-primary btn-sm float-right" (click)="exportToPdf()"&gt;
                Export to PDF
    &lt;/button&gt;
  </code></pre>