Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

html2pdf example angular

npm i html2pdf.js

HTML:

... <!--HTML tabel-->

<button (click)="download()">Download PDF</button>

.ts file:

import * as html2pdf from 'html2pdf.js'

...
download(){
    var element = document.getElementById('table');
	var opt = {
  		margin:       1,
  		filename:     'output.pdf',
  		image:        { type: 'jpeg', quality: 0.98 },
  		html2canvas:  { scale: 2 },
  		jsPDF:        { unit: 'in', format: 'letter', orientation: 'portrait' }
	};
 	// New Promise-based usage:
	html2pdf().from(element).set(opt).save();
}

in the tsconfig.json file add this line:
"noImplicitAny": false,
Comment

PREVIOUS NEXT
Code Example
Javascript :: Summernote keyup event jquery 
Javascript :: vscode rest api extention POST method 
Javascript :: css class list 
Javascript :: discord token 
Javascript :: copy text on click 
Javascript :: check if number is decimal or integer js 
Javascript :: javascript ready state 
Javascript :: how to compare objets in an array 
Javascript :: How to access the GET parameters after “?” in Express 
Javascript :: String.toLower() js 
Javascript :: how to handle fetch errors 
Javascript :: javascript backwards loop array 
Javascript :: js create array with default value 
Javascript :: sanitizer content nodejs 
Javascript :: mongodb find all that dont have property 
Javascript :: useeffect dependency error 
Javascript :: how to find date in a string js 
Javascript :: cart page url in shopify 
Javascript :: list of higher-order functions javascript 
Javascript :: puppeteer headless 
Javascript :: set localstorage 
Javascript :: jquery hide select option 
Javascript :: create an element jquery 
Javascript :: regex must match exactly 
Javascript :: remove duplicates multidimensional array javascript 
Javascript :: react native vector icons not working 
Javascript :: how to disable and enable a button in jquery 
Javascript :: clear interval js 
Javascript :: fetching data with react 
Javascript :: how to remove an object from an array javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =