Created
December 16, 2018 07:47
-
-
Save zymawy/97b228d2d5f126bb616f7b4ef35d6cac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```php | |
Route::get('put', function() { | |
$member = App\Member::with([ | |
'relatives', | |
'desires', | |
'skills', | |
'experiences', | |
'user' | |
])->find(3)->toArray(); | |
$memberNames = explode(" ", $member['full_name']); | |
$name = isset($memberNames[0]) ? (string) $memberNames[0] : "" ; | |
$fathorName = isset($memberNames[1]) ? (string) $memberNames[1] : "" ; | |
$grandName = isset($memberNames[2]) ? (string) $memberNames[2] : "" ; | |
$surnName = isset($memberNames[3]) ? (string) $memberNames[3] : "" ; | |
// dd($member); | |
$pdf = new Mpdf\Mpdf(config('pdf')); | |
$pdf->SetImportUse(); | |
$pdf->setSourceFile(public_path('images/original.pdf')); | |
$pdf->SetFont('KFGQPC','',12); | |
// Add The First Page | |
$pdf->addPage('P','A4'); | |
$tplIdx1 = $pdf->ImportPage(1); | |
$pdf->useTemplate($tplIdx1); | |
// Member Code | |
$pdf->SetXY(107,0); | |
$pdf->WriteCell( 10,30, $member['member_code'],'','','R'); | |
// Member Personal Photo | |
$pdf->SetXY(30,20); | |
$pdf->Image(asset('images/personals/default.png'), 20, 20, 25, 30, 'png', '', true, false); | |
// $pdf->WriteCell( 10,30, ,'','','R'); | |
// First Name | |
$pdf->SetXY(157,70); | |
$pdf->WriteCell( 10,30, $name,'','','R'); | |
// Second Name | |
$pdf->SetXY(128,70); | |
$pdf->WriteCell( 10,30, $fathorName,'','','R'); | |
// Third Name | |
$pdf->SetXY(100,70); | |
$pdf->WriteCell( 10,30, $grandName,'','','R'); | |
// Fourth Name | |
$pdf->SetXY(73,70); | |
$pdf->WriteCell( 10,30, $surnName,'','','R'); | |
// Born At | |
$pdf->SetXY(31,72); | |
$pdf->SetFont('KFGQPC','',10); | |
$pdf->WriteCell( 10,30, \Carbon\Carbon::now()->format('Y m d '),'','','R'); | |
// Identity Number | |
$pdf->SetXY(157,81); | |
$pdf->WriteCell( 10,30, $member['user']['identity_number'],'','','R'); | |
// Identity Expired At | |
$pdf->SetXY(115,81); | |
$pdf->WriteCell( 10,30, $member['id_expired_at'],'','','R'); | |
// Job In Id | |
$pdf->SetXY(67,81); | |
$pdf->WriteCell( 10,30, $member['job_in_id'],'','','R'); | |
// Social Status | |
$pdf->SetXY(27,81); | |
$pdf->WriteCell( 10,30, $member['social_status'],'','','R'); | |
// Social Status | |
$pdf->SetXY(27,81); | |
$pdf->WriteCell( 10,30, $member['social_status'],'','','R'); | |
// Phone Number | |
$pdf->SetXY(157,87); | |
$pdf->WriteCell( 10,30, $member['user']['phone_number'],'','','R'); | |
$pdf->SetXY(89,87); | |
$pdf->WriteCell( 10,30, $member['user']['email'],'','','R'); | |
// Study Level | |
$pdf->SetXY(29,87); | |
$pdf->WriteCell( 10,30, $member['study_level'],'','','R'); | |
// Major | |
$pdf->SetXY(165,93); | |
$pdf->WriteCell( 10,30, $member['major'],'','','R'); | |
// Address | |
$pdf->SetXY(105,93); | |
$pdf->WriteCell( 10,30, $member['address'],'','','R'); | |
// Residence | |
$pdf->SetXY(122,99); | |
$pdf->WriteCell( 10,30, $member['residence'],'','','R'); | |
// Residence Type | |
$pdf->SetXY(76,106); | |
$pdf->setCSS([ | |
'background' => '#DDD' | |
]); | |
$pdf->WriteCell( 10,30, $member['residence_type'],'','','R'); | |
// $pdf ->Line(0, 0, $pdf -> w, $pdf -> h); | |
// Add The Second Page | |
$pdf->addPage('P','A4'); | |
$tplIdx2 = $pdf->ImportPage( 2); | |
$pdf->useTemplate($tplIdx2); | |
// $pdf->WriteFixedPosHTML(" | |
// <p style='font-family: 'Taha Naskh' !important;'>حمزة مالم موسى</p> | |
// ", 160, 120, 50, 90, 'auto'); | |
// $pdf->WriteFixedPosHTML('This text will appear just where I want it!', 160, 120, 50, 90, 'auto'); | |
$pdf->SetFont('XB Riyaz','',18); | |
$pdf->Output(); | |
}); | |
Route::get('put/wss', function() { | |
$member = App\Member::with([ | |
'relatives', | |
'desires', | |
'skills', | |
'experiences', | |
'user' | |
])->find(3); | |
// $pdf = \PDF::loadView('admin.exports.members.pdf.form',['member' => $member]); | |
// dd($member->full_name); | |
$memberNames = explode(" ", $member->full_name); | |
$name = isset($memberNames[0]) ? (string) $memberNames[0] : "" ; | |
$fathorName = isset($memberNames[1]) ? (string) $memberNames[1] : "" ; | |
$grandName = isset($memberNames[2]) ? (string) $memberNames[2] : "" ; | |
$surnName = isset($memberNames[3]) ? (string) $memberNames[3] : "" ; | |
$pdf = new Mpdf\Mpdf(config('pdf')); | |
//Loading data | |
$pdf->SetTopMargin(20); $pdf->SetLeftMargin(20); $pdf->SetRightMargin(20); | |
$pdf->AddPage(); | |
// Print the edge of | |
$pdf->Image(public_path('images/cert2.png'), 20, 20, 780); | |
// Print the certificate logo | |
$pdf->Image(public_path('images/tt1.png'), 140, 180, 240); | |
// Print the title of the certificate | |
$pdf->SetFont('times','B',80); | |
$pdf->Cell(720+10,200,"CERTIFICATE",0,0,'C'); | |
$pdf->SetFont('Arial','I',34); | |
$pdf->SetXY(370,220); | |
$pdf->Cell(350,25,"Ttile","B",0,'C',0); | |
// $pdf->SetFont('Arial','I',14); | |
// $pdf->SetXY(370,280); | |
// $message = "ON COMPLETION OF"; | |
// $pdf->MultiCell(350,14,$message,0,'C',0); | |
$pdf->SetFont('Arial','B',16); | |
$pdf->SetXY(370,470); | |
$signataire = "TheTUTOR"; | |
$pdf->Cell(350,19,$signataire,"T",0,'C'); | |
$pdf->Output(); | |
//// $pdf->mpdf->SetWatermarkImage(public_path('images/formRegister.png')); | |
//// $pdf->mpdf->showWatermarkImage = true; | |
//// $pdf->mpdf->watermarkImageAlpha = 0.5; | |
//// $pdf->SetTopMargin(20); $pdf->SetLeftMargin(300); $pdf->SetRightMargin(20); | |
//// $pdf->AddPage(); | |
//// $pdf->Image(public_path('images/formRegister.png'), 0, 0, 210, 297, 'png', '', true, true); | |
//// | |
// $pdf->mpdf->SetFont('Arial','',11); | |
// $pdf->mpdf->SetXY(0,0); | |
//// $pdf->mpdf->WriteCell(50,50,$name,0,1,'R'); | |
// $pdf->mpdf->WriteCell(152,-399,$name,0,1,'R'); | |
//// | |
//// $pdf->SetFont('Arial','',11); | |
// $pdf->mpdf->SetXY(0,0); | |
// $pdf->mpdf->WriteCell(126,-399,$fathorName,0,1,'R'); | |
//// | |
//// $pdf->SetFont('Arial','',11); | |
// $pdf->mpdf->SetXY(0,0); | |
// $pdf->mpdf->WriteCell(98,-399,$grandName,0,1,'R'); | |
//// | |
//// $pdf->SetFont('Arial','',11); | |
// $pdf->mpdf->SetXY(0,0); | |
// $pdf->mpdf->WriteCell(73,-399,$surnName,0,1,'R'); | |
// | |
//// $pdf->SetFont('Arial','I',34); | |
//// $pdf->SetXY(0,0); | |
//// | |
//// $pdf->Cell(0,0,'Hamza',"B",0,'C',0); | |
//// | |
//// $pdf->SetFont('Arial','I',14); | |
//// $pdf->SetXY(0,0); | |
//// $message = "ON COMPLETION OF"; | |
//// $pdf->MultiCell(0,0,$message,0,'C',0); | |
// | |
//// $pdf->mpdf->Output(); | |
// | |
// return $pdf->stream(); | |
}); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment