added PdfCreator Controller, added fpdf greek fonts, updated SubmittedApplication Component

parent a7f11899
......@@ -271,7 +271,7 @@ epal.findcapacityperschool:
requirements:
_user_is_logged_in: 'TRUE'
epal.applicant.creationpdf:
path: '/epal/pdf-application'
path: '/epal/pdf-application/{studentId}'
options:
_auth: [ 'basic_auth' ]
defaults:
......
<?php
$type = 'TrueType';
$name = 'OpenSans-Bold';
$desc = array('Ascent'=>765,'Descent'=>-240,'CapHeight'=>714,'Flags'=>32,'FontBBox'=>'[-619 -293 1319 1069]','ItalicAngle'=>0,'StemV'=>120,'MissingWidth'=>600);
$up = -75;
$ut = 50;
$cw = array(
chr(0)=>600,chr(1)=>600,chr(2)=>600,chr(3)=>600,chr(4)=>600,chr(5)=>600,chr(6)=>600,chr(7)=>600,chr(8)=>600,chr(9)=>600,chr(10)=>600,chr(11)=>600,chr(12)=>600,chr(13)=>600,chr(14)=>600,chr(15)=>600,chr(16)=>600,chr(17)=>600,chr(18)=>600,chr(19)=>600,chr(20)=>600,chr(21)=>600,
chr(22)=>600,chr(23)=>600,chr(24)=>600,chr(25)=>600,chr(26)=>600,chr(27)=>600,chr(28)=>600,chr(29)=>600,chr(30)=>600,chr(31)=>600,' '=>260,'!'=>286,'"'=>472,'#'=>646,'$'=>571,'%'=>901,'&'=>750,'\''=>266,'('=>339,')'=>339,'*'=>545,'+'=>571,
','=>290,'-'=>322,'.'=>285,'/'=>413,'0'=>571,'1'=>571,'2'=>571,'3'=>571,'4'=>571,'5'=>571,'6'=>571,'7'=>571,'8'=>571,'9'=>571,':'=>285,';'=>290,'<'=>571,'='=>571,'>'=>571,'?'=>477,'@'=>897,'A'=>690,
'B'=>672,'C'=>637,'D'=>740,'E'=>560,'F'=>549,'G'=>724,'H'=>765,'I'=>331,'J'=>331,'K'=>664,'L'=>565,'M'=>943,'N'=>813,'O'=>796,'P'=>628,'Q'=>796,'R'=>660,'S'=>551,'T'=>579,'U'=>756,'V'=>650,'W'=>967,
'X'=>667,'Y'=>624,'Z'=>579,'['=>331,'\\'=>413,']'=>331,'^'=>532,'_'=>411,'`'=>607,'a'=>604,'b'=>633,'c'=>514,'d'=>633,'e'=>591,'f'=>387,'g'=>565,'h'=>657,'i'=>305,'j'=>305,'k'=>620,'l'=>305,'m'=>982,
'n'=>657,'o'=>619,'p'=>633,'q'=>633,'r'=>454,'s'=>497,'t'=>434,'u'=>657,'v'=>569,'w'=>856,'x'=>578,'y'=>569,'z'=>488,'{'=>394,'|'=>551,'}'=>394,'~'=>571,chr(127)=>600,chr(128)=>600,chr(129)=>600,chr(130)=>600,chr(131)=>600,
chr(132)=>600,chr(133)=>600,chr(134)=>600,chr(135)=>600,chr(136)=>600,chr(137)=>600,chr(138)=>600,chr(139)=>600,chr(140)=>600,chr(141)=>600,chr(142)=>600,chr(143)=>600,chr(144)=>600,chr(145)=>600,chr(146)=>600,chr(147)=>600,chr(148)=>600,chr(149)=>600,chr(150)=>600,chr(151)=>600,chr(152)=>600,chr(153)=>600,
chr(154)=>600,chr(155)=>600,chr(156)=>600,chr(157)=>600,chr(158)=>600,chr(159)=>600,chr(160)=>260,chr(161)=>217,chr(162)=>217,chr(163)=>571,chr(164)=>600,chr(165)=>600,chr(166)=>551,chr(167)=>486,chr(168)=>607,chr(169)=>832,chr(170)=>600,chr(171)=>615,chr(172)=>571,chr(173)=>322,chr(174)=>600,chr(175)=>1000,
chr(176)=>428,chr(177)=>571,chr(178)=>379,chr(179)=>379,chr(180)=>577,chr(181)=>577,chr(182)=>690,chr(183)=>285,chr(184)=>630,chr(185)=>835,chr(186)=>512,chr(187)=>615,chr(188)=>836,chr(189)=>881,chr(190)=>764,chr(191)=>786,chr(192)=>407,chr(193)=>690,chr(194)=>672,chr(195)=>561,chr(196)=>658,chr(197)=>560,
chr(198)=>579,chr(199)=>765,chr(200)=>796,chr(201)=>331,chr(202)=>664,chr(203)=>650,chr(204)=>943,chr(205)=>813,chr(206)=>571,chr(207)=>796,chr(208)=>745,chr(209)=>628,chr(210)=>600,chr(211)=>593,chr(212)=>579,chr(213)=>624,chr(214)=>860,chr(215)=>667,chr(216)=>876,chr(217)=>786,chr(218)=>331,chr(219)=>624,
chr(220)=>647,chr(221)=>555,chr(222)=>657,chr(223)=>407,chr(224)=>645,chr(225)=>647,chr(226)=>660,chr(227)=>568,chr(228)=>619,chr(229)=>555,chr(230)=>498,chr(231)=>657,chr(232)=>618,chr(233)=>407,chr(234)=>620,chr(235)=>615,chr(236)=>660,chr(237)=>595,chr(238)=>498,chr(239)=>619,chr(240)=>739,chr(241)=>618,
chr(242)=>498,chr(243)=>653,chr(244)=>538,chr(245)=>645,chr(246)=>792,chr(247)=>592,chr(248)=>837,chr(249)=>863,chr(250)=>407,chr(251)=>645,chr(252)=>619,chr(253)=>645,chr(254)=>863,chr(255)=>600);
$enc = 'ISO-8859-7';
$diff = '128 /.notdef 130 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 142 /.notdef 145 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 158 /.notdef /.notdef 161 /quoteleft /quoteright 164 /.notdef /.notdef 170 /.notdef 174 /.notdef /afii00208 180 /tonos /dieresistonos /Alphatonos 184 /Epsilontonos /Etatonos /Iotatonos 188 /Omicrontonos 190 /Upsilontonos /Omegatonos /iotadieresistonos /Alpha /Beta /Gamma /Delta /Epsilon /Zeta /Eta /Theta /Iota /Kappa /Lambda /Mu /Nu /Xi /Omicron /Pi /Rho /.notdef /Sigma /Tau /Upsilon /Phi /Chi /Psi /Omega /Iotadieresis /Upsilondieresis /alphatonos /epsilontonos /etatonos /iotatonos /upsilondieresistonos /alpha /beta /gamma /delta /epsilon /zeta /eta /theta /iota /kappa /lambda /mu /nu /xi /omicron /pi /rho /sigma1 /sigma /tau /upsilon /phi /chi /psi /omega /iotadieresis /upsilondieresis /omicrontonos /upsilontonos /omegatonos /.notdef';
$uv = array(0=>array(0,161),161=>array(8216,2),163=>163,166=>array(166,4),171=>array(171,3),175=>8213,176=>array(176,4),180=>array(900,3),183=>183,184=>array(904,3),187=>187,188=>908,189=>189,190=>array(910,20),211=>array(931,44));
$file = 'open-sans.bold.z';
$originalsize = 28736;
$subsetted = true;
?>
<?php
$type = 'TrueType';
$name = 'OpenSans-Light';
$desc = array('Ascent'=>765,'Descent'=>-240,'CapHeight'=>714,'Flags'=>32,'FontBBox'=>'[-521 -269 1140 1048]','ItalicAngle'=>0,'StemV'=>70,'MissingWidth'=>600);
$up = -75;
$ut = 50;
$cw = array(
chr(0)=>600,chr(1)=>600,chr(2)=>600,chr(3)=>600,chr(4)=>600,chr(5)=>600,chr(6)=>600,chr(7)=>600,chr(8)=>600,chr(9)=>600,chr(10)=>600,chr(11)=>600,chr(12)=>600,chr(13)=>600,chr(14)=>600,chr(15)=>600,chr(16)=>600,chr(17)=>600,chr(18)=>600,chr(19)=>600,chr(20)=>600,chr(21)=>600,
chr(22)=>600,chr(23)=>600,chr(24)=>600,chr(25)=>600,chr(26)=>600,chr(27)=>600,chr(28)=>600,chr(29)=>600,chr(30)=>600,chr(31)=>600,' '=>260,'!'=>240,'"'=>353,'#'=>646,'$'=>571,'%'=>807,'&'=>713,'\''=>192,'('=>272,')'=>272,'*'=>551,'+'=>571,
','=>215,'-'=>322,'.'=>238,'/'=>341,'0'=>571,'1'=>571,'2'=>571,'3'=>571,'4'=>571,'5'=>571,'6'=>571,'7'=>571,'8'=>571,'9'=>571,':'=>238,';'=>238,'<'=>571,'='=>571,'>'=>571,'?'=>421,'@'=>886,'A'=>600,
'B'=>627,'C'=>621,'D'=>706,'E'=>552,'F'=>502,'G'=>723,'H'=>719,'I'=>252,'J'=>247,'K'=>581,'L'=>513,'M'=>863,'N'=>721,'O'=>764,'P'=>585,'Q'=>764,'R'=>594,'S'=>545,'T'=>524,'U'=>719,'V'=>577,'W'=>892,
'X'=>538,'Y'=>528,'Z'=>576,'['=>319,'\\'=>341,']'=>319,'^'=>571,'_'=>411,'`'=>577,'a'=>530,'b'=>595,'c'=>475,'d'=>595,'e'=>549,'f'=>300,'g'=>523,'h'=>590,'i'=>226,'j'=>226,'k'=>484,'l'=>226,'m'=>883,
'n'=>590,'o'=>586,'p'=>595,'q'=>595,'r'=>389,'s'=>466,'t'=>335,'u'=>590,'v'=>459,'w'=>723,'x'=>498,'y'=>459,'z'=>461,'{'=>353,'|'=>541,'}'=>353,'~'=>571,chr(127)=>600,chr(128)=>600,chr(129)=>600,chr(130)=>600,chr(131)=>600,
chr(132)=>600,chr(133)=>600,chr(134)=>600,chr(135)=>600,chr(136)=>600,chr(137)=>600,chr(138)=>600,chr(139)=>600,chr(140)=>600,chr(141)=>600,chr(142)=>600,chr(143)=>600,chr(144)=>600,chr(145)=>600,chr(146)=>600,chr(147)=>600,chr(148)=>600,chr(149)=>600,chr(150)=>600,chr(151)=>600,chr(152)=>600,chr(153)=>600,
chr(154)=>600,chr(155)=>600,chr(156)=>600,chr(157)=>600,chr(158)=>600,chr(159)=>600,chr(160)=>260,chr(161)=>145,chr(162)=>145,chr(163)=>571,chr(164)=>600,chr(165)=>600,chr(166)=>541,chr(167)=>516,chr(168)=>577,chr(169)=>832,chr(170)=>600,chr(171)=>432,chr(172)=>571,chr(173)=>322,chr(174)=>600,chr(175)=>1000,
chr(176)=>428,chr(177)=>571,chr(178)=>336,chr(179)=>336,chr(180)=>577,chr(181)=>577,chr(182)=>600,chr(183)=>238,chr(184)=>596,chr(185)=>763,chr(186)=>294,chr(187)=>432,chr(188)=>770,chr(189)=>740,chr(190)=>645,chr(191)=>785,chr(192)=>307,chr(193)=>600,chr(194)=>627,chr(195)=>502,chr(196)=>571,chr(197)=>552,
chr(198)=>576,chr(199)=>719,chr(200)=>764,chr(201)=>252,chr(202)=>581,chr(203)=>600,chr(204)=>863,chr(205)=>721,chr(206)=>531,chr(207)=>764,chr(208)=>714,chr(209)=>585,chr(210)=>600,chr(211)=>551,chr(212)=>524,chr(213)=>528,chr(214)=>762,chr(215)=>538,chr(216)=>764,chr(217)=>775,chr(218)=>252,chr(219)=>528,
chr(220)=>590,chr(221)=>453,chr(222)=>590,chr(223)=>307,chr(224)=>595,chr(225)=>590,chr(226)=>608,chr(227)=>480,chr(228)=>581,chr(229)=>453,chr(230)=>467,chr(231)=>590,chr(232)=>570,chr(233)=>307,chr(234)=>484,chr(235)=>503,chr(236)=>596,chr(237)=>513,chr(238)=>459,chr(239)=>586,chr(240)=>612,chr(241)=>584,
chr(242)=>475,chr(243)=>587,chr(244)=>446,chr(245)=>595,chr(246)=>678,chr(247)=>514,chr(248)=>721,chr(249)=>734,chr(250)=>307,chr(251)=>595,chr(252)=>586,chr(253)=>595,chr(254)=>734,chr(255)=>600);
$enc = 'ISO-8859-7';
$diff = '128 /.notdef 130 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 142 /.notdef 145 /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef 158 /.notdef /.notdef 161 /quoteleft /quoteright 164 /.notdef /.notdef 170 /.notdef 174 /.notdef /afii00208 180 /tonos /dieresistonos /Alphatonos 184 /Epsilontonos /Etatonos /Iotatonos 188 /Omicrontonos 190 /Upsilontonos /Omegatonos /iotadieresistonos /Alpha /Beta /Gamma /Delta /Epsilon /Zeta /Eta /Theta /Iota /Kappa /Lambda /Mu /Nu /Xi /Omicron /Pi /Rho /.notdef /Sigma /Tau /Upsilon /Phi /Chi /Psi /Omega /Iotadieresis /Upsilondieresis /alphatonos /epsilontonos /etatonos /iotatonos /upsilondieresistonos /alpha /beta /gamma /delta /epsilon /zeta /eta /theta /iota /kappa /lambda /mu /nu /xi /omicron /pi /rho /sigma1 /sigma /tau /upsilon /phi /chi /psi /omega /iotadieresis /upsilondieresis /omicrontonos /upsilontonos /omegatonos /.notdef';
$uv = array(0=>array(0,161),161=>array(8216,2),163=>163,166=>array(166,4),171=>array(171,3),175=>8213,176=>array(176,4),180=>array(900,3),183=>183,184=>array(904,3),187=>187,188=>908,189=>189,190=>array(910,20),211=>array(931,44));
$file = 'open-sans.light.z';
$originalsize = 28156;
$subsetted = true;
?>
......@@ -14,22 +14,11 @@ import {Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
import * as html2canvas from "html2canvas"
import { API_ENDPOINT, API_ENDPOINT_PARAMS } from '../../app.settings';
import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial-state';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray
} from '@angular/forms';
@Component({
selector: 'submited-preview',
template: `
<div class = "loading" *ngIf="(showLoader$ | async) === true"></div>
<div class="row">
<breadcrumbs></breadcrumbs>
......@@ -66,7 +55,6 @@ import {
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
<table>
<tr>
<td>
......@@ -100,8 +88,7 @@ import {
</div>
</ul>
<br>
<button type="button" (click)="createPdfServerSide()">Εξαγωγή σε PDF</button>
<button type="button" (click)="createPdfServerSide()" [disabled] = "userActive == -1">Εξαγωγή σε PDF</button>
<!--
<form [formGroup]="formGroup" method = "POST" action="{{apiEndPoint}}/drupal-8.2.6/epal/pdf-application" #form>
......@@ -116,31 +103,18 @@ import {
@Injectable() export default class SubmitedPreview implements OnInit , OnDestroy{
private apiEndPointParams = API_ENDPOINT_PARAMS;
public formGroup: FormGroup;
loginInfo$: BehaviorSubject<ILoginInfo>;
loginInfoSub: Subscription;
private SubmitedApplic$: BehaviorSubject<any>;
private SubmitedUsersSub: Subscription;
private SubmitedDetails$: BehaviorSubject<any>;
private SubmitedDetailsSub: Subscription;
private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription;
private incomeChosen$: BehaviorSubject<any>;
private incomeChosenSub: Subscription;
private CritirioChosen$: BehaviorSubject<any>;
private CritirioChosenSub: Subscription;
private showLoader$: BehaviorSubject<boolean>;
private data;
private authToken: string;
private role: string;
public StudentId;
private userActive = <number>-1;
......@@ -150,7 +124,7 @@ import {
private _hds: HelperDataService,
private activatedRoute: ActivatedRoute,
private router: Router ,
private fb: FormBuilder,
/*private fb: FormBuilder,*/
)
{
this.SubmitedApplic$ = new BehaviorSubject([{}]);
......@@ -160,10 +134,6 @@ import {
this.incomeChosen$ = new BehaviorSubject([{}]);
this.showLoader$ = new BehaviorSubject(false);
this.formGroup = this.fb.group({
});
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
}
ngOnDestroy()
......@@ -179,11 +149,6 @@ import {
if (this.incomeChosenSub)
this.incomeChosenSub.unsubscribe();
if (this.loginInfoSub)
this.loginInfoSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe();
this.SubmitedApplic$.unsubscribe();
......@@ -192,20 +157,6 @@ import {
ngOnInit() {
this.loginInfoSub = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.role = loginInfoToken.auth_role;
console.log("....");
console.log(this.authToken);
return loginInfoToken;
}, {});
}
return state.loginInfo;
}).subscribe(this.loginInfo$);
this.showLoader$.next(true);
this.SubmitedUsersSub = this._hds.getSubmittedPreviw().subscribe(
......@@ -226,8 +177,6 @@ import {
}
setActiveUser(ind,i)
{
ind = +ind;
......@@ -261,13 +210,10 @@ import {
}
createPdf1()
{
createPdf_version1() {
html2canvas(document.getElementById("target")).then(function(canvas)
{
var img=new Image();
img.src=canvas.toDataURL();
img.onload=function(){
......@@ -277,26 +223,19 @@ import {
doc.addImage(img, 'PNG',0, 0, 210, 297);
console.log(img, doc, "ok2");
doc.save('applications.pdf');
}
},
function(error){
console.log("i fail");
});
}
}
createPdf()
{
createPdf() {
html2canvas(document.getElementById("target"), <Html2Canvas.Html2CanvasOptions>{
html2canvas(document.getElementById("target"), <Html2Canvas.Html2CanvasOptions>{
onrendered: function(canvas: HTMLCanvasElement) {
var img = canvas.toDataURL();
var doc = new jsPDF();
......@@ -310,29 +249,17 @@ html2canvas(document.getElementById("target"), <Html2Canvas.Html2CanvasOptions>{
doc.addImage(img, 'PNG',0, 0, 1000, 1000);
console.log("mphkaneoneo");
doc.save('applications.pdf');
}
});
}
}); }
createPdfServerSide()
{
this._hds.createPdfServerSide(this.authToken, this.role);
/*
this._hds.createPdfServerSide(this.authToken, this.role)
.then(msg => {
//console.log("Nikos2");
})
.catch(err => {console.log(err);
//console.log("Nikos1");
console.log(err);
});
*/
//this._hds.createPdfServerSide(this.authToken, this.role, this.userActive +1 );
this._hds.createPdfServerSide(this.userActive +1 );
}
......
......@@ -37,7 +37,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
</div>
</div>
<button type="button" (click)="createPdf()">Εξαγωγή σε PDF</button>
<button type="button" (click)="createPdfServerSide()">Εξαγωγή σε PDF</button>
`
})
......@@ -98,19 +98,7 @@ import { BehaviorSubject, Subscription } from 'rxjs/Rx';
createPdfServerSide()
{
//this.SubmitedDetailsSub = this._hds.createPdfServerSide().subscribe(this.SubmitedDetails$);
/*
this._hds.createPdfServerSide()
.then(msg => {
//console.log("Nikos2");
})
.catch(err => {console.log(err);
//console.log("Nikos1");
console.log(err);
});
*/
this._hds.createPdfServerSide(this.StudentId);
}
......
......@@ -1027,84 +1027,36 @@ createPdfServerSide_OLD(auth_token, role) {
createPdfServerSide(auth_token, role) {
/*
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
console.log("Θα μπει;");
console.log(this.authToken);
});
*/
//createPdfServerSide(auth_token, role, headerid) {
createPdfServerSide(headerid) {
let headers = new Headers({
"Content-Type": "application/json",
//"Access-Control-Allow-Origin": "true",
});
this.authToken = auth_token;
this.authRole = role;
// console.log(this.authToken);
// console.log(this.authRole);
//this.authToken = auth_token;
//this.authRole = role;
console.log("Ποια είναι;");
console.log(this.authToken);
console.log(this.authRole);
this.createAuthorizationHeader(headers);
// let options = new RequestOptions([{ headers: headers }, { responseType: ResponseContentType.ArrayBuffer }]);
let options = new RequestOptions({ headers: headers, responseType: ResponseContentType.Blob });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/pdf-application/`, options)
// .map(response => response.json())
// .map((res: Response): Blob => {
// return (<any>res)._body;
// })
// .map((res: Response): Blob => {
// return res.ok ?
// // res.blob()
// new Blob([(<any>res)._body], { type: 'application/octet-stream' })
// : undefined;
// })
// .map(res => res.blob())
//.map(response => (<Response>response).blob())
let headerIdStr = headerid.toString();
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/pdf-application/` + headerIdStr, options)
.map( (res) => {
return new Blob([res['_body']], {type: "application/octet-stream" })
})
.subscribe(
data => {
console.log(data);
// var blob = new Blob([data['pdfString']], { type: 'application/octet-stream' });
// var blob = new Blob([data.arrayBuffer()], { type: 'application/octet-stream' });
// var blob = new Blob([data.blob()], { type: 'application/pdf' });
// var blob = new Blob([data], { type: 'application/pdf' });
// var blob = new Blob([btoa(data['pdfString'])]);
// console.log(blob);
FileSaver.saveAs(data, "testData.pdf");
// var url = window.URL.createObjectURL(blob);
// window.open(url);
},
err => console.error(err),
() => console.log('PDF export completed')
);
/*
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/pdf-application`, options)
//.map(response => response.json())
.subscribe(data => {
resolve(data);
console.log("Nik");
var blob = new Blob([data['_body']], {type: 'application/pdf'});
console.log(blob);
FileSaver.saveAs(blob, "testData.pdf");
//console.log(data['_body']);
},
error => {
reject("Error POST in createPdfServerSide");
},
() => console.log("Nikos!!!"));
});
*/
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment