<?php
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);    

// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Kikin Kusumah');
$pdf->SetTitle($title);
$pdf->SetSubject('');
$pdf->SetKeywords('TCPDF, PDF, Kikinsoft');

// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

// set margins
$pdf->SetMargins(10, 15, 10);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, 10);

// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
	require_once(dirname(__FILE__).'/lang/eng.php');
	$pdf->setLanguageArray($l);
}

//echo dirname(dirname(dirname(dirname(__FILE__)))).'/libraries/tcpdf_barcodes_1d_includek.php';
require_once(dirname(dirname(dirname(dirname(__FILE__)))).'/libraries/tcpdf_barcodes_1d_includek.php');

// set the barcode content and type
// $barcodeobj = new TCPDFBarcode('http://www.tcpdf.org', 'C128');


// ---------------------------------------------------------

// set font
$pdf->SetFont('helvetica', '', 8);

$filename = '';

// add a page
$pdf->AddPage('P','A4');
//$pdf->Cell(0, 1, 'Nama', 1, 0, 'L','','','','','','T');
// writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
// writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=0, $reseth=true, $align='', $autopadding=true)
$html="";
// create some HTML content
$html .= 
'
<h4 style="text-align: center;"><strong>PT. KOSTEC INDONESIA</strong></h4>
<p style="text-align: center;">Jl. Lingkungan I Ciriung RT. 002 RW. 001 Ciriung Cibinong 16918 Bogor</p>
<p style="text-align: center;"><br></p>
<h4 style="text-align: center;"><strong>INVOICE &amp; PACKING LIST</strong></h4>
<table style="width: 100%;">
    <tbody>
        <tr>
            <td style="width: 19.1176%;">SOLD TO</td>
            <td style="width: 28.7582%;">: PT. HIROSE</td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">DATE</td>
            <td style="width: 22.6891%;">: 22 JULI 2019</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;">CONSIGNEE</td>
            <td style="width: 28.7582%;">: PT. HIROSE</td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">INVOICE NO.</td>
            <td style="width: 22.6891%;">: KOSTEC</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;">DELIVERY TO</td>
            <td style="width: 28.7582%;">: PT. HIROSE</td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">PAYMENT TERM</td>
            <td style="width: 22.6891%;"><br></td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">SHIPMENT FROM</td>
            <td style="width: 22.6891%;">: PT. KOSTEC</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">
                <div style="text-align: right;">TO</div>
            </td>
            <td style="width: 22.6891%;">: PT. HIROSE</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">SHIPPED DATE</td>
            <td style="width: 22.6891%;">: 22 JULI 2019</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;">SHIPPED PER</td>
            <td style="width: 22.6891%;">: BY TRUCK</td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 24.5378%;"><br></td>
            <td style="width: 22.6891%;"><br></td>
        </tr>
        <tr>
            <td style="width: 19.1176%;"><br></td>
            <td style="width: 28.7582%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td colspan="2" style="width: 46.8908%; text-align: center;">NO COMMERCIAL VALUE</td>
        </tr>
    </tbody>
</table>
<p><br></p>
<table border="1" style="width: 100%;">
    <tbody>
        <tr>
            <td class="fr-thick" style="width: 13.1349%; text-align: center;">WEIGTH<br>(KG)</td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;">C/NO</td>
            <td class="fr-thick" style="width: 16.1121%; text-align: center;">QUANTITY PCE</td>
            <td class="fr-thick" style="width: 21.1909%; text-align: center;">DESCRIPTION</td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;">S/NO</td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;">P/NO</td>
            <td class="fr-thick" style="width: 17.1629%; text-align: center;">UNITPRICE USD</td>
            <td class="fr-thick" style="width: 4.028%; text-align: center;">AMOUNT USD</td>
        </tr>
        <tr>
            <td style="width: 13.1349%; text-align: center;">GW/NW</td>
            <td style="width: 9.4571%; text-align: center;">CT</td>
            <td style="width: 16.1121%; text-align: center;"><br></td>
            <td style="width: 21.1909%; text-align: center;"><strong>RETURN</strong></td>
            <td style="width: 9.4571%; text-align: center;"><br></td>
            <td style="width: 9.4571%; text-align: center;"><br></td>
            <td style="width: 17.1629%; text-align: center;"><br></td>
            <td style="width: 4.028%; text-align: center;"><br></td>
        </tr>
        <tr>
            <td style="width: 13.1349%; text-align: center;"><br></td>
            <td style="width: 9.4571%; text-align: center;"><br></td>
            <td style="width: 16.1121%; text-align: center;"><br></td>
            <td style="width: 21.1909%; text-align: center;"><br></td>
            <td style="width: 9.4571%; text-align: center;"><br></td>
            <td style="width: 9.4571%; text-align: center;"><br></td>
            <td style="width: 17.1629%; text-align: center;"><br></td>
            <td style="width: 4.028%; text-align: center;"><br></td>
        </tr>
        <tr>
            <td class="fr-thick" style="width: 13.1349%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 16.1121%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 21.1909%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 9.4571%; text-align: center;"><br></td>
            <td class="fr-thick" style="width: 17.1629%; text-align: center;"><strong>TOTAL</strong></td>
            <td class="fr-thick" style="width: 4.028%; text-align: center;"><br></td>
        </tr>
    </tbody>
</table>
<p><br></p>
<p><br></p>
<table style="width: 100%;">
    <tbody>
        <tr>
            <td style="width: 12.5000%;">Surat Jalan No</td>
            <td colspan="5" style="width: 46.0504%;">:</td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;"><br></td>
        </tr>
        <tr>
            <td style="width: 12.5000%;">Balance</td>
            <td colspan="5" style="width: 46.0504%;"><br></td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;">For and on behalf of</td>
        </tr>
        <tr>
            <td style="width: 12.5000%;">MEASUREMENT</td>
            <td style="width: 12.5000%;">:</td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 11.2605%;"><br></td>
            <td style="width: 5.042%;"><br></td>
            <td style="width: 12.7731%;"><br></td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;">PT. KOSTEC INDONESIA</td>
        </tr>
        <tr>
            <td style="width: 12.5000%;">
                <div style="margin-left: 80px;">:</div>
            </td>
            <td style="width: 12.5000%;">LENGTH</td>
            <td style="width: 5.042%;">X</td>
            <td style="width: 11.2605%;">WIDTH</td>
            <td style="width: 5.042%;">X</td>
            <td style="width: 12.7731%;">HEIGHT</td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;"><br></td>
        </tr>
        <tr>
            <td style="width: 12.5000%;">
                <div style="margin-left: 80px;">:</div>
            </td>
            <td style="width: 12.5000%;"><br></td>
            <td style="width: 5.042%;">X</td>
            <td style="width: 11.2605%;"><br></td>
            <td style="width: 5.042%;">X</td>
            <td style="width: 12.7731%;"><br></td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;"><br>
                <pre></pre>
            </td>
        </tr>
        <tr>
            <td style="width: 12.5000%;">
                <div style="margin-left: 80px;">:</div>
            </td>
            <td colspan="5" style="width: 46.0504%;"><br></td>
            <td style="width: 5.2101%;"><br></td>
            <td style="width: 25.5462%;"><strong><u>ADE BUDIMAN</u></strong></td>
        </tr>
    </tbody>
</table>
';

$filename = $rhdr->po_no;
// output the HTML content
$pdf->writeHTML($html, true, false, true, false, '');


// ---------------------------------------------------------    

// Close and output PDF document
// This method has several options, check the source code documentation for more information.
// $pdf->Output($rs[$j]->po_no.'.pdf', 'I');
$pdf->Output($filename.'.pdf', 'I');

?>        