Add most relevant content to PDF export
This commit is contained in:
parent
4ce0f22212
commit
999f0b2937
@ -5,6 +5,7 @@ import { animate, style, transition, trigger } from '@angular/animations';
|
||||
import cloneDeep from 'lodash/cloneDeep';
|
||||
import omit from 'lodash/omit';
|
||||
import { DataService } from '../services/data.service';
|
||||
import { LoginService } from '../services/login.service';
|
||||
import { ModelItemModel } from '../models/model-item.model';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import * as pdfMake from "pdfmake/build/pdfmake";
|
||||
@ -67,7 +68,8 @@ export class PredictionComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private api: ApiService,
|
||||
public d: DataService
|
||||
public d: DataService,
|
||||
public login: LoginService
|
||||
) {
|
||||
this.chart[0] = cloneDeep(this.chartInit);
|
||||
}
|
||||
@ -145,6 +147,102 @@ export class PredictionComponent implements OnInit {
|
||||
|
||||
// Converts the prediction results to a PDF file
|
||||
exportPDF() {
|
||||
// TODO: Generate PDF export
|
||||
const dd = {
|
||||
content: [
|
||||
{
|
||||
text: 'DeFinMa - Decoding the Fingerprint of Materials by AI',
|
||||
style: 'header'
|
||||
},
|
||||
{
|
||||
table: {
|
||||
body: [
|
||||
[new Date().toLocaleDateString(), 'Security class', 'Person in charge', 'Phone'],
|
||||
[this.activeGroup.group, 'Intern',
|
||||
{
|
||||
stack: [
|
||||
'CR/APS1-Lotter',
|
||||
'CR/APS1-Lingenfelser'
|
||||
]
|
||||
},
|
||||
{
|
||||
stack: [
|
||||
'0711/811-49017',
|
||||
'0711/811-6897'
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
bold: true,
|
||||
text: 'Customer'
|
||||
},
|
||||
this.login.username,
|
||||
{
|
||||
text: 'Prediction of ' + this.activeGroup.group + ' (' + this.activeGroup.models[this.activeModelIndex].name + ')*',
|
||||
style: 'subheader'
|
||||
},
|
||||
{
|
||||
text: this.result.mean.map(e => e.category + ' ' + e.value + ' ' + e.label + ' ' + (e.std !== '' ? (' (standard deviation: ' + e.std + ')') : ''))
|
||||
},
|
||||
{
|
||||
table: {
|
||||
widths: ['*', 'auto'],
|
||||
body: [
|
||||
['Input Data / Sample Name', 'Prediction*']
|
||||
].concat(this.prepareExport())
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Reference Data',
|
||||
style: 'subheader'
|
||||
},
|
||||
{
|
||||
image: document.getElementsByTagName('canvas')[0].toDataURL('image/png'),
|
||||
width: 500
|
||||
},
|
||||
{
|
||||
text: '*Disclaimer: This tool is still under development and Testing',
|
||||
style: 'subsubheader'
|
||||
},
|
||||
{
|
||||
text: [
|
||||
'The prediction and classification of material parameters are validated only for certain conditions.',
|
||||
'These results may therefore under no circumstances be used to evaluate quality-relevant issues.',
|
||||
'For more details please contact ',
|
||||
{
|
||||
text: 'CR/APS1-Lingenfelder',
|
||||
link: 'mailto:dominic.lingenfelser@bosch.com'
|
||||
},
|
||||
'.'
|
||||
]
|
||||
},
|
||||
{
|
||||
table: {
|
||||
body: [
|
||||
['Pr\u00fcfung', 'Freigabe', 'Datum'],
|
||||
['CR/APS1-Lotter', 'CR/APS1-Lingenfelser', new Date().toLocaleDateString()]
|
||||
]
|
||||
}
|
||||
},
|
||||
'\u00a9 Alle Rechte bei Robert Bosch GmbH, auch f\u00fcr den Fall von Schutzreichtsanmeldungen. Jede Verf\u00fcgungsbefugnis, wie Kopier- und Weitergaberecht, bei uns.'
|
||||
],
|
||||
styles: {
|
||||
header: {
|
||||
fontSize: 18,
|
||||
bold: true
|
||||
},
|
||||
subheader: {
|
||||
fontSize: 15,
|
||||
bold: true
|
||||
},
|
||||
subsubheader: {
|
||||
bold: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
pdfMake.createPdf(dd).download();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user