Useful PHP Sample Coding Website Links


Myanmar Font in TC/PDF export in PHP with laravel

You need to download the font ttf file

<?php namespace App\Core;

use Validator;
use Auth;
use DB;
use App\Http\Requests;
use App\Session;
use PDF;

class Utility
// Use Pdf Export
public static function exportPDF($html,$pdfTitle = 'exportPDF')

require_once(base_path() . '/vendor/tecnickcom/tcpdf/include/tcpdf_fonts.php');
$fontname = TCPDF_FONTS::addTTFfont(app_path() .'/Core/Export/Zawgyi-One-20051130.ttf', 'TrueTypeUnicode', '', 32);

// $font1 = PDF::addTTFfont('/home/waiyan/Downloads/Zawgyi-One-20051130.ttf', 'TrueTypeUnicode', '', 8);
PDF::SetFont($fontname, '', 15, '', false);

// set font
//PDF::SetFont('helvetica', '', 12);
PDF::writeHTML($html, true, false, false, false, '');

PDF::Output($pdfTitle . '.pdf');



namespace App\Core\Export;

use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use App\Core\Config\Config;
use App\Core\Utility;
use PDF;

class ServicePdfGenerator implements IPDFGeneratorInterface
public function generate($paramObj)


$html = <<<EOD

.table_main {
font-size: 10;

.table_border {
border: 1;

ကခဂ ကခဂ ကခဂ ကခဂ


return true;


dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system

Problem 1
    - dompdf/dompdf v0.7.0 requires ext-gd * -> the requested PHP extension gd is missing from your system.
    - barryvdh/laravel-dompdf v0.7.0 requires dompdf/dompdf ^0.7 -> satisfiable by dompdf/dompdf[v0.7.0].
    - Installation request for barryvdh/laravel-dompdf ^0.7.0 -> satisfiable by barryvdh/laravel-dompdf[v0.7.0].


If you are working in PHP version 5.* then you have to install

sudo apt-get install php5-gd
And if you are working in PHP version 7.* then you have to install

sudo apt-get install php7.0-gd

Hope it will work..


Upgrade to PHP 7.0 on Ubuntu

Ref :

Prerequisites and disclaimer

My server is a Ubuntu 14.04 box that uses Apache 2.4 and PHP 5.5.9 prior to upgrade. These instructions are for Apache 2.4 users with a similar configuration, and I recommend you test in isolation before using in a production environment. Proceed at your own risk.

Step 1 – Add a new Apt source

At the time of writing, I’m using the packages maintained by a guy called Ondřej Surý (he’s worth a follow on Twitter) until there’s a Debian package for PHP 7 in the official release channels.

To do this, enter the following command into the box you’re upgrading:

sudo add-apt-repository ppa:ondrej/php

You’ll probably be prompted to enter your password at this point. Go ahead and enter it.

Step 2 – Install updates and the PHP 7.0 package

Next we’re going to update and upgrade packages on our system to ensure everything goes smoothly. You can do this in a single command with:

sudo apt-get update && sudo apt-get upgrade

Once this has finished, we’re ready to install PHP 7.0. Enter the following command into your terminal:

sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-mcrypt php7.0-curl

This will install PHP 7.0, along with a number of commonly used PHP packages including the Apache PHP 7 module. I found that everything else pretty much worked without being installed separately. That’s it pretty much. You shouldn’t need to make any configuration changes and everything should just work.

Step 3 – Test to ensure your server is using PHP 7.0

From the command line, type the following command:

php -v