Give this a try
HTML code snippet
<td id="myTd"><input [(ngModel)]="userName" type="text"
[value]="userName"></td>
TypeScript code snippet
export class AppComponent {
name = 'Converting Angular HTML to PDF ';
userName: string;
@ViewChild('pdfTable', {static: false}) pdfTable: ElementRef;
public downloadAsPDF() {
const doc = new jsPDF();
var x = document.getElementById("myTd");
x.innerHTML = this.userName;
const specialElementHandlers = {
'#editor': function (element, renderer) {
return true;
}
};
const pdfTable = this.pdfTable.nativeElement;
doc.fromHTML(pdfTable.innerHTML, 15, 15, {
width: 190,
'elementHandlers': specialElementHandlers
});
console.log(doc.output('dataurl'));
console.log(this.userName);
}
}
Check out the live demo on StackBlitz