Advertisement
Guest User

Untitled

a guest
May 24th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public captureScreen(id: string) {
  2. console.log(id);
  3. const data = document.getElementById(id);
  4. html2canvas(data).then(canvas => {
  5. const imgWidth = 208;
  6. const pageHeight = 295;
  7. const imgHeight = canvas.height * imgWidth / canvas.width;
  8. const heightLeft = imgHeight;
  9. const contentDataURL = canvas.toDataURL('image/png');
  10. const pdf = new jspdf('p', 'mm', 'a4');
  11. const position = 0;
  12. pdf.addImage(contentDataURL, 'PNG', 0, position, imgWidth, imgHeight);
  13. pdf.save('lijst.pdf');
  14. });
  15. }
  16.  
  17.  
  18.  
  19.  
  20. <div class="row justify-content-around mb-3" *ngIf="order.orderId">
  21. <h5 >Bestellingscode {{order?.orderId || ""}}</h5>
  22. <input type="button" class="btn btn-primary" value="Print order" (click)="captureScreen(order?.orderId)" />
  23. </div>
  24. <table class="table" attr.id="{{order?.orderId}}">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement