Add PDF title
This commit is contained in:
parent
6267ff5071
commit
e5c679570a
|
@ -28,7 +28,8 @@ export class DashboardAdminComponent implements OnInit {
|
||||||
const _reporteUsuarios = { usuarios_activos: 100, usuarios_bloqueados: 50 };
|
const _reporteUsuarios = { usuarios_activos: 100, usuarios_bloqueados: 50 };
|
||||||
|
|
||||||
const _excelFinalData = [_reporteUsuarios];
|
const _excelFinalData = [_reporteUsuarios];
|
||||||
exportAsExcelFile(_sheets, _excelFinalData, 'reporte_general');
|
const _fileName = 'reporte_general';
|
||||||
|
exportAsExcelFile(_sheets, _excelFinalData, _fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
exportReportesGeneralesAdministradorPDF(): void {
|
exportReportesGeneralesAdministradorPDF(): void {
|
||||||
|
@ -47,7 +48,9 @@ export class DashboardAdminComponent implements OnInit {
|
||||||
|
|
||||||
const _headers = ['usuarios_activos', 'usuarios_bloqueados'];
|
const _headers = ['usuarios_activos', 'usuarios_bloqueados'];
|
||||||
const _docHeaders = createPDFTableHeaders(_headers);
|
const _docHeaders = createPDFTableHeaders(_headers);
|
||||||
|
const _fileName = 'reporte_general';
|
||||||
|
const _docTitle = 'Reportes Generales de la Aplicación';
|
||||||
|
|
||||||
generatePDFTable(doc, _docData, _docHeaders);
|
generatePDFTable(doc, _docData, _docHeaders, _fileName, _docTitle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,11 @@ export const createPDFTableHeaders = (keys: any): any[] => {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const generatePDFTable = (doc: jsPDF, _docData: any, _docHeaders: string[]): void => {
|
export const generatePDFTable = (doc: jsPDF, _docData: any, _docHeaders: string[], _fileName: string, _docTitle: string): void => {
|
||||||
doc.table(1, 1, _docData, _docHeaders, { autoSize: true });
|
doc.setFontSize(20);
|
||||||
const generatedFileName = generateFileName('reporte_general', PDF_EXTENSION);
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.text(_docTitle, 20, 20);
|
||||||
|
doc.table(20, 30, _docData, _docHeaders, { autoSize: true });
|
||||||
|
const generatedFileName = generateFileName(_fileName, PDF_EXTENSION);
|
||||||
doc.save(generatedFileName);
|
doc.save(generatedFileName);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue