submited.aplication.preview.ts 2.11 KB
Newer Older
Open Source Developer's avatar
Open Source Developer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
import { Component, OnInit, ElementRef, ViewChild} from "@angular/core";
let jsPDF = require('jspdf');
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import {Observable} from "rxjs/Observable";
import {IStudentDataFields, IStudentDataField} from '../../store/studentdatafields';
import {Http, Headers, RequestOptions} from '@angular/http';
import * as html2canvas from "html2canvas"
import {Removetags} from '../../pipes/removehtmltags';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';



@Component({
    selector: 'submited-preview',
    template: `
        <div id = "target">
            Έχετε ολοκληρώσει την αίτηση για εγγραφή στην επαγγελπατική εκπαίδευση των παρακάτω ατόμων:
            <div *ngFor="let userdata$ of submitedusers$ | async; ">
                <br>
                <br>
                 <strong>Στοιχεία υποψηφίου μαθητή: </strong>    <br>     
                 <br>
                

                
            </div>        
        </div>     
        <button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
                  
   `
})

@Injectable() export default class SubmitedPreview implements OnInit {

    public submitedapplic$: any;
    public submitedusers$:any;
    
    public html2canvas: any;
    private loginInfo$: Observable<ILoginInfo>;
    private user :string;
    
    constructor(private _hds: HelperDataService, 
              public http: Http,
              private _ngRedux: NgRedux<IAppState>,) 
    {
      
    }



    ngOnInit() {

     

     

    }


    createPdf()
    {

        html2canvas(document.getElementById("target")).then(function(canvas)
         {
        var img = canvas.toDataURL();
        var doc = new jsPDF('p', 'mm');
        doc.addImage(img, 'PNG', 10, 10);
        doc.save('applications.pdf');
     }
   
    );
    }
}