Example #1
11
 private function printPDF($customer_id, $post_device, $post_user, $comment, $username, $randomcode, $date)
 {
     require_once Mage::getBaseDir('lib') . '/tcpdf/tcpdf.php';
     // create new PDF docume, nt
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set font
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     $pdf->setJPEGQuality(100);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->SetLineWidth(0.2);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->setCellHeightRatio(1);
     // set color for background
     $pdf->SetFillColor(255, 255, 255);
     // Multicell
     // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
     // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 0, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, $pdf->getY() + 1, true, 0, false);
     // Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
     // $pdf->Image(dirname(__FILE__). '/bcimages/'. $randkey . '.png',80,8,100,8,'','','',true);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/gbr.png', 182, 10, 20, 60, '', '', '', true);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     //$pdf->MultiCell(70, 15, ' 1. ' . $naziv1, 'LT', 'L', 1, 0, 10, '', true, 0, false);
     //$pdf->MultiCell(40, 15, $_POST['sn1'], 'T', 'L', 1, 0, 80, '', true, 0, false);
     //$pdf->MultiCell(60, 15, $opis1, 'TR', 'L', 1, 0, 120, '', true, 0, false);
     //$pdf->Ln();
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(120, 6, 'Pratite stanje Vašeg uredjaja na servisu.<br>Posetite <b>http://proveraservisa.gamebox.co.rs/</b> i unesite Vaš kontrolni kod<br />ili skenirajte <b>QR</b> kod pomocu Vašeg mobilnog telefona', 0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->Ln(3);
     $pdf->MultiCell(110, 10, "\n" . Mage::getStoreConfig('servisnilist/text/upozorenje'), 1, 'C', 1, 0, 50, '', true, 0, false);
     $pdf->Ln();
     if (count($post_device) == 1) {
         $pdf->Ln();
     }
     $pdf->Ln(5);
     $pdf->Image(Mage::getBaseDir('media') . '/pdf/cut-here.png', 3, '', 250, 3, '', '', '', false, 300, '', false, false, 0, true);
     $pdf->Ln(9);
     $x = $pdf->GetX();
     $y = $pdf->GetY();
     // bottom part
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(50, 8, 'SERVISNI LIST - REVERS', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->SetFont('helvetica', '', 8);
     $pdf->MultiCell(100, 0, 'GAMEBOX, Cara Dušana 47, Niš - tel 018/514-666 - 060/514-666-0', 0, 'L', 1, 0, 80, '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 8);
     $pdf->Cell(70, 6, 'Naziv uredjaja', 0, 0, 'L', 0);
     $pdf->Cell(40, 6, 'Serijski broj', 0, 0, 'L', 0);
     $pdf->Cell(60, 6, 'Opis kvara', 0, 0, 'L', 0);
     $pdf->Ln();
     $i = 1;
     foreach ($post_device as $key => $post) {
         if ($i == 1) {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'LT', 'L', 1, 0, 10, '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 'T', 'L', 1, 0, 80, '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'TR', 'L', 1, 0, 120, '', true, 0, false);
         } else {
             $pdf->MultiCell(70, 6, ' ' . $i . '. ' . $post['name'], 'L', 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(40, 6, $post['sn'], 0, 'L', 1, 0, '', '', true, 0, false);
             $pdf->MultiCell(60, 6, $post['description'], 'R', 'L', 1, 0, '', '', true, 0, false);
         }
         $pdf->Ln();
         ++$i;
     }
     $pdf->MultiCell(70, 1, ' ', 'LB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(40, 1, ' ', 'B', 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(60, 1, ' ', 'RB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Dodatna uputstva / komentari', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(170, 5, $comment, 'TRLB', 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Obracun', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Materijal', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 6, 'Opis usluge', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'j. mere', 0, 0, 'L', 0);
     $pdf->Cell(15, 6, 'kolicina', 0, 0, 'L', 0);
     $pdf->Cell(20, 6, 'cena', 0, 0, 'L', 0);
     $pdf->Cell(25, 6, 'UKUPNO', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->Cell(90, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(15, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(20, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Cell(25, 5, ' ', 'TRLB', 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(60, 6, 'SVEGA:', 'B', 'L', 1, 0, 120, $pdf->getY() + 1, true, 0, false);
     $pdf->Ln();
     $pdf->Cell(70, 6, 'Na servis predao', 0, 0, 'L', 0);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Ime:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['name'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Datum i vreme prijema:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $date, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Email:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['email'], 0, 'L', 1, 0, 25, '', true, 0, false);
     $pdf->MultiCell(50, 6, 'Kontrolni kod:', 0, 'L', 1, 0, 70, '', true, 0, false);
     $pdf->MultiCell(50, 6, $randomcode, 0, 'L', 1, 0, 100, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Telefon:', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $post_user['phone'], 0, 'L', 1, 0, 25, '', true, 0, false);
     //$pdf->Image(dirname(__FILE__) . '/bcimages/' . $randkey . '.png', 66, $pdf->getY() - 2, 100, 8, '', '', '', true, 300, '', false, false, 0, false);
     // $pdf->MultiCell(120, 6, 'Pratite stanje Vaseg uredjaja na servisu.<br>Posetite <b>http://bengazi.com/proveraservisa</b> i unesite Vas kontrolni kod' ,0, 'L', 1, 0, 70, '', true, 0, true);
     $pdf->Ln();
     $pdf->MultiCell(20, 6, 'Potpis:', 0, 'L', 1, 0, '', '', true, 0, false);
     // CODE 128 B
     // define barcode style
     $style1d = array('position' => 'S', 'align' => 'C', 'stretch' => false, 'fitwidth' => true, 'cellfitalign' => '', 'border' => false, 'hpadding' => '35', 'vpadding' => '30', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 8, 'stretchtext' => 4);
     $pdf->setXY(180, $y + 35);
     //155
     $pdf->StartTransform();
     $pdf->Rotate(90);
     $pdf->write1DBarcode($randomcode, 'C128B', '', '', '', 14, 0.5, $style1d, 'T');
     $pdf->StopTransform();
     // new style
     $styleQR = array('border' => false, 'padding' => 0, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false);
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode('http://proveraservisa.gamebox.co.rs/?kk=' . $randomcode, 'QRCODE,H', 184, 75, 50, 50, $styleQR, 'N');
     // QRCODE,H : QR-CODE Best error correction
     $pdf->write2DBarcode(Mage::getBaseUrl() . 'servisnilist/status/qr/slid/' . $customer_id, 'QRCODE,H', 184, $y + 65, 50, 50, $styleQR, 'N');
     // Close and output PDF document
     $pdf->IncludeJS('print();');
     // die('y');
     //ob_clean(); //stupid tcpdf need this
     $pdf->Output('trt.pdf', 'I');
     exit;
 }
Example #2
3
    public function testPdfOutput()
    {
        $this->markTestIncomplete('Travis failure needs further investigation. ');
        // 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('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 014');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 014', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // IMPORTANT: disable font subsetting to allow users editing the document
        $pdf->setFontSubsetting(false);
        // set font
        $pdf->SetFont('helvetica', '', 10, '', false);
        // add a page
        $pdf->AddPage();
        /*
        It is possible to create text fields, combo boxes, check boxes and buttons.
        Fields are created at the current position and are given a name.
        This name allows to manipulate them via JavaScript in order to perform some validation for instance.
        */
        // set default form properties
        $pdf->setFormDefaultProp(array('lineWidth' => 1, 'borderStyle' => 'solid', 'fillColor' => array(255, 255, 200), 'strokeColor' => array(255, 128, 128)));
        $pdf->SetFont('helvetica', 'BI', 18);
        $pdf->Cell(0, 5, 'Example of Form', 0, 1, 'C');
        $pdf->Ln(10);
        $pdf->SetFont('helvetica', '', 12);
        // First name
        $pdf->Cell(35, 5, 'First name:');
        $pdf->TextField('firstname', 50, 5);
        $pdf->Ln(6);
        // Last name
        $pdf->Cell(35, 5, 'Last name:');
        $pdf->TextField('lastname', 50, 5);
        $pdf->Ln(6);
        // Gender
        $pdf->Cell(35, 5, 'Gender:');
        $pdf->ComboBox('gender', 30, 5, array(array('', '-'), array('M', 'Male'), array('F', 'Female')));
        $pdf->Ln(6);
        // Drink
        $pdf->Cell(35, 5, 'Drink:');
        //$pdf->RadioButton('drink', 5, array('readonly' => 'true'), array(), 'Water');
        $pdf->RadioButton('drink', 5, array(), array(), 'Water');
        $pdf->Cell(35, 5, 'Water');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Beer', true);
        $pdf->Cell(35, 5, 'Beer');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Wine');
        $pdf->Cell(35, 5, 'Wine');
        $pdf->Ln(6);
        $pdf->Cell(35, 5, '');
        $pdf->RadioButton('drink', 5, array(), array(), 'Milk');
        $pdf->Cell(35, 5, 'Milk');
        $pdf->Ln(10);
        // Newsletter
        $pdf->Cell(35, 5, 'Newsletter:');
        $pdf->CheckBox('newsletter', 5, true, array(), array(), 'OK');
        $pdf->Ln(10);
        // Address
        $pdf->Cell(35, 5, 'Address:');
        $pdf->TextField('address', 60, 18, array('multiline' => true, 'lineWidth' => 0, 'borderStyle' => 'none'), array('v' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 'dv' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'));
        $pdf->Ln(19);
        // Listbox
        $pdf->Cell(35, 5, 'List:');
        $pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
        $pdf->Ln(20);
        // E-mail
        $pdf->Cell(35, 5, 'E-mail:');
        $pdf->TextField('email', 50, 5);
        $pdf->Ln(6);
        // Date of the day
        $pdf->Cell(35, 5, 'Date:');
        $pdf->TextField('date', 30, 5, array(), array('v' => date('Y-m-d'), 'dv' => date('Y-m-d')));
        $pdf->Ln(10);
        $pdf->SetX(50);
        // Button to validate and print
        $pdf->Button('print', 30, 10, 'Print', 'Print()', array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Reset Button
        $pdf->Button('reset', 30, 10, 'Reset', array('S' => 'ResetForm'), array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Submit Button
        $pdf->Button('submit', 30, 10, 'Submit', array('S' => 'SubmitForm', 'F' => 'http://localhost/printvars.php', 'Flags' => array('ExportFormat')), array('lineWidth' => 2, 'borderStyle' => 'beveled', 'fillColor' => array(128, 196, 255), 'strokeColor' => array(64, 64, 64)));
        // Form validation functions
        $js = <<<EOD
function CheckField(name,message) {
    var f = getField(name);
    if(f.value == '') {
        app.alert(message);
        f.setFocus();
        return false;
    }
    return true;
}
function Print() {
    if(!CheckField('firstname','First name is mandatory')) {return;}
    if(!CheckField('lastname','Last name is mandatory')) {return;}
    if(!CheckField('gender','Gender is mandatory')) {return;}
    if(!CheckField('address','Address is mandatory')) {return;}
    print();
}
EOD;
        // Add Javascript code
        $pdf->IncludeJS($js);
        $this->comparePdfs($pdf);
    }
Example #3
0
    public function testPdfOutput()
    {
        // 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('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 053');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        // set default header data
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 053', PDF_HEADER_STRING);
        // set header and footer fonts
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        // set default monospaced font
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        // set margins
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        // set auto page breaks
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        // set image scale factor
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        // set some language-dependent strings (optional)
        $pdf->setLanguageArray($this->langSettings);
        // ---------------------------------------------------------
        // set font
        $pdf->SetFont('times', '', 14);
        // add a page
        $pdf->AddPage();
        // print a some of text
        $text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
        $pdf->writeHTML($text, true, 0, true, 0);
        // write some JavaScript code
        $js = <<<EOD
app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({
    cQuestion: 'How are you today?',
    cTitle: 'Your Health Status',
    cDefault: 'Fine',
    cLabel: 'Response:'
});
if (cResponse == null) {
    app.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else {
    app.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
        // force print dialog
        $js .= 'print(true);';
        // set javascript
        $pdf->IncludeJS($js);
        // ---------------------------------------------------------
        $this->comparePdfs($pdf);
    }
    public function printpackagingslip()
    {
        $this->layout = '';
        $this->autoRender = false;
        $order = $this->getOpenOrderById('100024');
        //pr($order);
        $serviceLevel = $order['shipping_info']->PostalServiceName;
        $assignedservice = $order['assigned_service'];
        $courier = $order['courier'];
        $manifest = $order['manifest'] == 1 ? '1' : '0';
        $cn22 = $order['cn22'] == 1 ? '1' : '0';
        $barcode = $order['assign_barcode'];
        $subtotal = $order['totals_info']->Subtotal;
        $totlacharge = $order['totals_info']->TotalCharge;
        $ordernumber = $order['num_order_id'];
        $fullname = $order['customer_info']->Address->FullName;
        $address1 = $order['customer_info']->Address->Address1;
        $address2 = $order['customer_info']->Address->Address2;
        $address3 = $order['customer_info']->Address->Address3;
        $town = $order['customer_info']->Address->Town;
        $resion = $order['customer_info']->Address->Region;
        $postcode = $order['customer_info']->Address->PostCode;
        $country = $order['customer_info']->Address->Country;
        $paymentmethod = $order['totals_info']->PaymentMethod;
        $recivedate = explode('T', $order['general_info']->ReceivedDate);
        $address = $address1 . ',' . $address2 . ',' . $address3;
        App::import('Vendor', 'tcpdf/tcpdf');
        //$pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // add a page
        $resolution = array(10, 15);
        $pdf->AddPage('P', $resolution);
        $date = date("Y-m-d");
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetHeaderData('', '', 'Service', '');
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 8);
        $pdf->AddPage();
        $j = 0;
        $imgPath = WWW_ROOT . 'css/';
        $imageurl = Router::url('/img/source', true);
        $html = '<body>
					   <div id="label">
						  <div class="container">
							 <div class="header row">
								<div class="leftside"><img src=' . $imageurl . '/vitapure.png></div>
								<div class="rightside ">
								   <div class="barcode center">
									  &nbsp;
									  <div class="right">4584327-0</div>
									  <span class="center">4584327-0</span>
								   </div>
								</div>
							 </div>
							 <div class="cn22 row">
								<div class="leftside address">
								   <h4>Ship From:</h4>
								   <span class="bold">SPC Limited</span><br>
								   Longueville Road<br>
								   St Saviour Jersey JE2 7WF<br>
								   E: sales@vitapure.co.uk<br>
								   T: 0845 800 8888
								</div>
								<div class="rightside address">
								   <h4>Ship To:</h4>
								   <span class="bold">' . $fullname . '</span><br>
								   ' . $address1 . '<br>
								   ' . $address2 . ', ' . $address3 . ',' . $town . ', ' . $resion . ',' . $postcode . '<br>
								   ' . $country . '<br>
								   T: 07517063902<br>
								</div>
							 </div>
							 <div class="header row">
								<div class="leftside">
								   <div><span class="bold">Order No.:</span>' . $ordernumber . '</div>
								   <div><span class="bold">Order Date:</span>' . $recivedate[0] . '</div>
								</div>
								<div class="rightside">
								   <div><span class="bold">Ship Via:</span>' . $courier . '</div>
								   <div><span class="bold">Payment Method:</span>' . $paymentmethod . '</div>
								</div>
							 </div>
							 <div class="tablesection row">
								<table class="" border="1" cellpadding="5px">
								   <tr>
									  <th class="noleftborder" width="15%">Item No.</th>
									  <th valign="top" width="40%">Description of contents</th>
									  <th valign="top" class="center" width="5%">Qty</th>
									  <th valign="top" class="center" width="15%">Price</th>
									  <th valign="top" class="center norightborder" width="15%">Amount</th>
								   </tr>';
        $i = 1;
        $subtotal = 0;
        foreach ($order['items'] as $item) {
            $html .= '<tr>
									  <td valign="top" class="noleftborder">' . $i . '</td>
									  <td valign="top">' . $item->Title . '</td>
									  <td valign="top" class="center">' . $item->Quantity . '</td>
									  <td valign="top" class="right">£' . $item->PricePerUnit . '</td>
									  <td valign="top" class="right norightborder">£' . $item->CostIncTax . '</td>
										</tr>';
            $i++;
            $subtotal = $subtotal + $item->PricePerUnit;
        }
        $j = $i - 1;
        $html .= '</table>
								<div class="otherinfo">
								   <div><span class="bold">Total Item Count:</span> ' . $j . '</div>
								   <div><span class="bold">Payment Reference:</span> 4G073562WB731302E</div>
								</div>
								<div class="totalprice">
								   <div class="leftside right">Sub Total</div>
								   <div class="rightside right">£' . $subtotal . '</div>
								   <div class="leftside right">Shipping</div>
								   <div class="rightside right">£9.25</div>
								   <div class="leftside right">Tax</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right">Discount</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right">Other Charges</div>
								   <div class="rightside right">£0.00</div>
								   <div class="leftside right bold">Order Total</div>
								   <div class="rightside right bold">£166.21</div>
								</div>
							 </div>
							 <div class="footer row">
								Thanks for shopping with us. It was a pleasure to serve you.
								Get special 5% off on next purchase by using promo code: WELCOMEBACK
							 </div>
						  </div>
					   </div>
					</body>';
        $html .= '<style>' . file_get_contents($imgPath . 'packing.css') . '</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
    public function printpackagingslip()
    {
        $this->layout = '';
        $this->autoRender = false;
        $order = $this->getOpenOrderById('100024');
        //pr($order);
        $serviceLevel = $order['shipping_info']->PostalServiceName;
        $assignedservice = $order['assigned_service'];
        $courier = $order['courier'];
        $manifest = $order['manifest'] == 1 ? '1' : '0';
        $cn22 = $order['cn22'] == 1 ? '1' : '0';
        $barcode = $order['assign_barcode'];
        $subtotal = $order['totals_info']->Subtotal;
        $totlacharge = $order['totals_info']->TotalCharge;
        $ordernumber = $order['num_order_id'];
        $fullname = $order['customer_info']->Address->FullName;
        $address1 = $order['customer_info']->Address->Address1;
        $address2 = $order['customer_info']->Address->Address2;
        $address3 = $order['customer_info']->Address->Address3;
        $town = $order['customer_info']->Address->Town;
        $resion = $order['customer_info']->Address->Region;
        $postcode = $order['customer_info']->Address->PostCode;
        $country = $order['customer_info']->Address->Country;
        $paymentmethod = $order['totals_info']->PaymentMethod;
        $recivedate = explode('T', $order['general_info']->ReceivedDate);
        $address = $address1 . ',' . $address2 . ',' . $address3;
        App::import('Vendor', 'tcpdf/tcpdf');
        //$pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // add a page
        $resolution = array(100, 150);
        $pdf->AddPage('P', $resolution);
        $date = date("Y-m-d");
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetHeaderData('', '', 'Service', '');
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(false, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 8);
        //$pdf->AddPage();
        $j = 0;
        $imgPath = WWW_ROOT . 'css/';
        $imageurl = Router::url('/img/source', true);
        $html = '<style>
body{margin:0px;}
#label{padding:10px; width:394px; font-size:11px; color:#000000; font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; }
#label .container{width:100%}
 .header,  .cn22,  .tablesection,  .footer{border-bottom:2px solid #000000; clear:both; padding:8px 4px;}
 .footer{line-height:1.2}
 .leftside,  .rightside,  .date,  .sign{ width:50%}
 .jpoststamp{border:1px solid #000000; padding:1px;width:150px; float:right}
 .stampnumber{width: 35%; border:1px solid #000000; padding:4px; background:#000000;  color:#ffffff; text-align:center; font-size:22px; line-height:1.2}
 .jerseyserial{ float: left;    padding: 0 5px;    width: 65%; line-height:1; text-transform:uppercase; font-size:12px;font-weight:bold}
 .vatnumber{ float: left;    padding: 2px 0 0 0; line-height:1.2; font-size:11px;font-weight:bold}
 h1{font-family:"Oswald"; font-size:16px; margin:0px}
 h3{font-size:12px;font-weight:bold; margin:0}
 h4{font-size:14px;font-weight:bold; margin:0 0 5px}
 .rightheading{text-align:center;}
 .fullwidth{clear:both}
 .fullwidth h2{text-align:center; font-size:14px; font-weight:bold; margin:0; padding:5px 0;}
 .fullwidth p{line-height:1.2; margin-top:5px}
 .producttype{margin-bottom:5px;}
 .producttype div{width:25%; display:inline-block;}
 .producttype span{border: 1px solid #000000;
    display: inline-block;
    height: 15px;
    line-height: 1.2;
    margin-right: 5px;
    text-align:center;
    width: 15px;}
	 table{border:none; width:100%}
 th{ font-weight:bold;font-size:12px; }
 th,  td{padding:2px;line-height:1.2;}
 td table td{padding:0px;}
 .norightborder{border-right:0px;}
 .noleftborder{border-left:0px;}
 .rightborder{border-right:1px solid #000000;}
 .leftborder{border-left:1px solid #000000;}
 .topborder{border-top:1px solid #000000;}
 .bottomborder{border-bottom:1px solid #000000;}
 .center{text-align:center}
 .right{text-align:right}
 .bold{font-weight:bold;font-size:12px; }
 .sign{ margin-top: -20px;}
 .barcode{padding:5px 0;}
 .tracking{padding:5px 0;font-size:12px}
 .address{font-size:12px; line-height:1.2}
 .barcode div{font-family:"3 of 9 Barcode"; font-size:30px; margin: -5px 0;}
 .otherinfo{width:60%;  margin-top:5px}
 .totalprice{width:40%;  margin-top:5px}
 .tablesection{padding:0px 0px 8px ; margin-top:-1px}

</style>';
        $html .= '<body>
<div id="label">
<div class="container">
<table class="header row">
<tr>
<td>Logo</td>
<td>
<div class="barcode center">&nbsp;<div class="right">4584327-0</div><span class="center">4584327-0</span></div>
</td>
</tr>
</table>


<table class="cn22 row">
<tr>
<td class="leftside address"><h4>Ship From:</h4>
<span class="bold">SPC Limited</span><br>
Longueville Road<br>
St Saviour Jersey JE2 7WF<br>
E: sales@vitapure.co.uk<br>
T: 0845 800 8888
</td>

<td class="rightside address"><h4>Ship To:</h4>
<span class="bold">Julia Bastek</span><br>
12/13 Duddingston Mills<br>
Edinburgh, Midlothian, EH8 7TU<br>
United Kingdom<br>
T: 07517063902<br>
</td>
</tr>
</table>
<div class="">

</div>
<table class="header row">
<tr>
<td class="leftside"><span class="bold">Order No.:</span> 149680

</td>
<td><span class="bold">Ship Via:</span> Jersey Post</td>
</tr>
<tr>
<td class="rightside">
<span class="bold">Payment Method:</span> Paypal
</td>
<td><span class="bold">Order Date:</span> 23/09/2015</td>
</tr>
</table>

<div class="">
<table class="tablesection row" border="1" cellpadding="5px" cellspacing="0">
<tr>
<th class="" width="15%">Item No.</th>
<th valign="top" width="40%">Description of contents</th>
<th valign="top" class="center" width="15%">Qty</th>
<th valign="top" class="center" width="15%">Price</th>
<th valign="top" class="center " width="15%">Amount</th>
</tr>
<tr>
<td valign="top" class="">0001</td>
<td valign="top">Playtex Drop Ins Pre Sterilized Soft Bottle Liners, 8-10 oz. 100 ea</td>
<td valign="top" class="center">2</td>
<td valign="top" class="right">£75.00</td>
<td valign="top" class="right ">£150.00</td>
</tr>
<tr>
<td valign="top" class="">0002</td>
<td valign="top">Now Foods, Calcium Hydroxyapatite 250mg 120 Capsules</td>
<td valign="top" class="center">1</td>
<td valign="top" class="right">£6.96</td>
<td valign="top" class="right ">£6.96</td>
</tr>

</table>
<table>
<tr>
<td class="otherinfo">
<div><span class="bold">Total Item Count:</span> 3</div>
<div><span class="bold">Payment Reference:</span> 4G073562WB731302E</div></td>
<td class="totalprice">
<table>
<tr>
<td class="leftside right">Sub Total</td>
<td class="rightside right">£156.96</td>
</tr>
<tr>
<td class="leftside right">Shipping</td>
<td class="rightside right">£9.25</td>
</tr>
<tr>
<td class="leftside right">Tax</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right">Discount</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right">Other Charges</td>
<td class="rightside right">£0.00</td>
</tr>
<tr>
<td class="leftside right bold">Order Total</td>
<td class="rightside right bold">£166.21</td>
</tr>
</table>
</td>
</tr>
</table>


</div>
<div class="footer row">
Thanks for shopping with us. It was a pleasure to serve you.
Get special 5% off on next purchase by using promo code: WELCOMEBACK
</div>

</div>
</div>

</body>';
        //$html .= '<style>'.file_get_contents($imgPath.'packing.css').'</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
Example #6
0
$pdf->ComboBox('gender', 10, 5, array('', 'M', 'F'), array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
//Drink
$pdf->Cell(35, 5, 'Drink:');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Water');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Beer');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Wine');
// set export values
$pdf->IncludeJS("fdrink.exportValues=[\"Water\", \"Beer\", \"Wine\"];\n");
// check the second radiobutton
$pdf->IncludeJS("fdrink.checkThisBox(1,true);\n");
$pdf->Ln(10);
//Gender
$pdf->Cell(35, 5, 'List:');
$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
$pdf->Ln(20);
//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'strokeColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
Example #7
0
$pdf->SetFont('times', '', 14);
// add a page
$pdf->AddPage();
// print a some of text
$text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /><br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS()</i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
$pdf->writeHTML($text, true, 0, true, 0);
// write some JavaScript code
$js = <<<EOD
app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({
\tcQuestion: 'How are you today?',
\tcTitle: 'Your Health Status',
\tcDefault: 'Fine',
\tcLabel: 'Response:'
});
if (cResponse == null) {
\tapp.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else {
\tapp.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
// force print dialog
$js .= 'print(true);';
// set javascript
$pdf->IncludeJS($js);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_053.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
Example #8
0
        <td width="4%">:</td>
        <td class="datapasien">' . ucwords($pendaftaran->nama_lengkap) . '</td>
    </tr>
    <tr>
        <th>TTL</th>
        <td width="4%">:</td>
        <td class="datapasien">' . ucwords($pendaftaran->tpt_lahir) . ', ' . date("d-m-Y", strtotime($pendaftaran->tgl_lahir)) . '</td>
    </tr>
    <tr>
        <th>ALAMAT</th>
        <td width="4%">:</td>
        <td class="datapasien">' . $pendaftaran->jalan_1 . '</td>
    </tr>
    <tr>
        <th class="perhatian" width="56%">PERHATIAN<br/>
            <small>1. Setiap kali berobat di RSUD Serui, kartu ini harus selalu dibawa.<br/>
            2. Kartu berobat ini tidak dipergunakan oleh orang lain.<br/>
            3. Apabila kartu ini hilang mohon dilaporkan ke loket adm RSUD.</small>
        </th>
        <td class="ttd" width="44%">
            Serui, 03 Maret 2015<br/>Penanggung Jawab Adm Pelayanan<br/>TTD<br/><strong>PIGELUS REMATOBI</strong><br/>NIP. 19862805 200909 1 001
        </td>
    </tr>
</table>';
// force print dialog
$js .= 'print(true);';
// set javascript
$obj_pdf->IncludeJS($js);
ob_end_clean();
$obj_pdf->writeHTML($content, true, false, true, false, '');
$obj_pdf->Output('pendaftaran.pdf', 'I');
Example #9
0
    public function tcpdf()
    {
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor('Nicola Asuni');
        $pdf->SetTitle('TCPDF Example 053');
        $pdf->SetSubject('TCPDF Tutorial');
        $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
        $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 053', PDF_HEADER_STRING);
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 14);
        $pdf->AddPage();
        $text = 'This is an example of <strong>JavaScript</strong> usage on PDF documents.<br /> <br />For more information check the source code of this example, the source code documentation for the <i>IncludeJS() </i> method and the <i>JavaScript for Acrobat API Reference</i> guide.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
        $pdf->writeHTML($text, true, 0, true, 0);
        $js = <<<EOD
        app.alert('JavaScript Popup Example', 3, 0, 'Welcome');
var cResponse = app.response({ cQuestion: 'How are you today?', cTitle: 'Your Health Status', cDefault: 'Fine', cLabel: 'Response:' });
if (cResponse == null) { app.alert('Thanks for trying anyway.', 3, 0, 'Result');
} else { app.alert('You responded, "'+cResponse+'", to the health question.', 3, 0, 'Result');
}
EOD;
        $js .= 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('example_053.pdf', 'D');
        //   $pdf=new TCPDF();
        //        $pdf->Addpge('P','A4');
        //        $html='<html>
        //                <head></head>
        //                <body><table border="1">
        //                <tr><th>name</th>
        //                <th>company</th></tr>
        //                <tr>
        //                <td>helllo</td>
        //                <td>xx technologies</td>
        //                </tr>
        //                </table>
        //                </body>
        //                </html>';
        //
        //        $pdf->writeHTML($html, true,
        //                false, true, false, '');
        //        $pdf->Output();
        //
    }
Example #10
0
//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'BorderColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('BorderColor' => 'ltGray'));
$pdf->Ln(6);
//Newsletter
$pdf->Cell(35, 5, 'Receive our', 0, 1);
$pdf->Cell(35, 5, 'newsletter:');
$pdf->CheckBox('newsletter', 5, true);
$pdf->Ln(10);
//Date of the day (determined and formatted by JS)
$pdf->Write(5, 'Date: ');
$pdf->TextField('date', 30, 5);
$pdf->IncludeJS("getField('date').value=util.printd('dd/mm/yyyy',new Date());");
$pdf->Ln();
$pdf->Write(5, 'Signature:');
$pdf->Ln(3);
//Button to validate and print
$pdf->SetX(95);
$pdf->Button('print', 20, 8, 'Print', 'Print()', array('TextColor' => 'yellow', 'FillColor' => '#FF5050'));
//Form validation functions
$pdf->IncludeJS("\r\nfunction CheckField(name,message)\r\n{\r\n    f=getField(name);\r\n    if(f.value=='')\r\n    {\r\n        app.alert(message);\r\n        f.setFocus();\r\n        return false;\r\n    }\r\n    return true;\r\n}\r\n\r\nfunction Print()\r\n{\r\n    //Validation\r\n    if(!CheckField('firstname','First name is mandatory'))\r\n        return;\r\n    if(!CheckField('lastname','Last name is mandatory'))\r\n        return;\r\n    if(!CheckField('gender','Gender is mandatory'))\r\n        return;\r\n    if(!CheckField('address','Address is mandatory'))\r\n        return;\r\n    //Print\r\n    print();\r\n}\r\n");
// END JAVASCRIPT FORM --------------------------------------
//Close and output PDF document
$pdf->Output();
//============================================================+
// END OF FILE
//============================================================+
    public function imprimeCupomEntrada()
    {
        $objEmpresa = new fla_empresas();
        global $path_relative;
        $arrEmpresa = array();
        $arrRotatividade = array();
        $objModelo = new fla_modelos();
        $objCliente = new fla_clientes();
        $arrEmpresa = $objEmpresa->buscaEmpresas($objEmpresa);
        $pdf = new TCPDF("P", PDF_UNIT, 'ETIQUETA', true, 'IBM850', false);
        //$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf->SetMargins(0, 0, 0, true);
        //$pdf->SetMargins(PDF_MARGIN_LEFT,PDF_MARGIN_TOP,PDF_MARGIN_RIGHT);
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);
        $pdf->AddPage();
        // $nom_prestador  = limitar($arrEmpresa[0]['nom_fantasia'],25);
        $nom_prestador = $arrEmpresa[0]['nom_fantasia'];
        $end_prestador = $arrEmpresa[0]['des_endereco'];
        $tel_prestador = $arrEmpresa[0]['num_telefone'];
        $tel_prestador = mascara_string("(##) ####-####", $tel_prestador);
        $horario_atendimento = "Horario de atendimento:\r\n07:00hrs as 19:00hrs";
        $multa = "A perda deste cupom implicara \r\nem multa de R\$ 10,00";
        $arrRotatividade = $this->buscaCarro($this);
        $cod_cartao = $arrRotatividade[0]['cod_cartao'];
        $hora_entrada = $arrRotatividade[0]['hor_entrada'];
        $dat_entrada = mostraData($arrRotatividade[0]['dat_cadastro']);
        $des_placa = strtoupper($arrRotatividade[0]['des_placa']);
        $objCliente->set_des_placa($des_placa);
        $arrCliente = $objCliente->buscaClientes($objCliente);
        if (!empty($arrCliente[0]['cod_modelo'])) {
            $objModelo->set_cod_modelo($arrCliente[0]['cod_modelo']);
            $arrModelo = $objModelo->buscaModelos($objModelo);
            $des_modelo = $arrModelo[0]['des_modelo'];
        } else {
            $des_modelo = 'Nao cadastrado';
        }
        $des_modelo = remove_acentuacao($des_modelo);
        $pdf->SetFont('times', 'B', 8);
        $pdf->Write($h = 0, $nom_prestador, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $conteudo_cabecalho = sprintf("%s \r\nTelefone: %s\r\n\r\n", $end_prestador, $tel_prestador);
        $conteudo_cabecalho = iconv('UTF-8', 'IBM850', $conteudo_cabecalho);
        $pdf->Write($h = 0, $conteudo_cabecalho, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $style = array('position' => 'L', 'border' => false, 'padding' => 5, 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'text' => false, 'font' => 'helvetica', 'fontsize' => 3, 'stretchtext' => 2);
        $pdf->write1DBarcode($cod_cartao, 'C128', '', '', 60, 18, 0.4, $style, 'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128A','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128C','','',60,18,0.4,$style,'N');
        //$pdf->write1DBarcode($cod_cartao, 'C128B', '', '', 5, 5, 0.4, $style, 'N');
        $cod_cartao = iconv('UTF-8', 'IBM850', $cod_cartao);
        $pdf->Write($h = 0, 'Cartao: ' . $cod_cartao, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 12);
        $pdf->Write($h = 0, "Dia: {$dat_entrada} \r\nHorario: {$hora_entrada}", $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $conteudo_rodape = sprintf("\r\nVeiculo: %s\r\nPlaca: %s\r\n%s\r\n", $des_modelo, $des_placa, $horario_atendimento);
        $pdf->SetFont('times', 'B', 12);
        $conteudo_rodape = iconv('UTF-8', 'IBM850', $conteudo_rodape);
        $pdf->Write($h = 0, $conteudo_rodape, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        $pdf->SetFont('times', 'B', 10);
        $multa = iconv('UTF-8', 'IBM850', $multa);
        $pdf->Write($h = 0, $multa, $link = '', $fill = 0, $align = 'L', $ln = true, $stretch = 0, $firstline = false, $firstblock = false, $maxh = 0);
        // write some JavaScript code
        $js = <<<EOD
\t\t\t\tthis.print({bUI: true, bSilent: false, bShrinkToFit: true}); 
EOD;
        // set javascript
        $pdf->IncludeJS($js);
        //$arquivo_cartao = $pdf->Output('CupomEntrada-'.$cod_cartao,"S");
        //var_dump(file_put_contents($path_relative.'cupons/CupomEntrada-'.$cod_cartao, $arquivo_cartao));
        //$arquivo = $path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf';
        //$pdf->Output($path_relative.'cuponsEntrada/CupomEntrada-' . $cod_cartao.'.pdf',"F");
        $pdf->Output($path_relative . 'cuponsEntrada/CupomEntrada-' . $cod_cartao . '.pdf', "I");
        //$pdf->Output('CupomEntrada-' . $cod_cartao.'.pdf','I');
        //$comando = "C:\Sumatra\SumatraPDF.exe -print-to \"MP-2500 TH\" ".$arquivo;
        //exec($comando);
    }
Example #12
0
 public function PostAction()
 {
     $rma_ids = $this->getRequest()->getParam('povratnica');
     if (!count($rma_ids)) {
         exit;
     }
     $broj_povratnice = Mage::helper('rma')->getBrojPovratnice();
     $dobavljac = Mage::getModel('rma/rmadevices')->load($rma_ids[0])->getSupplier();
     require_once Mage::getBaseDir('lib') . '/tcpdf/tcpdf.php';
     // create new PDF document
     $pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set font
     $pdf->SetFont('helvetica', '', 11);
     // add a page
     $pdf->AddPage();
     $pdf->setJPEGQuality(100);
     // set cell padding
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->SetLineWidth(0.2);
     // set cell margins
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->setCellHeightRatio(1);
     // set color for background
     $pdf->SetFillColor(255, 255, 255);
     // Multicell
     // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
     // Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=0, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(150, 0, 'BENGAZI DOO NIŠ, KRFSKA 18', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'PIB: 104028469', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'šifra delatnosti: 4666', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(100, 0, 'TR: 160-214265-03 / Banca Intesa a.d.', 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 16);
     $pdf->MultiCell(100, 0, 'Povratnica na servis ' . date("Y") . "/" . $broj_povratnice, 0, 'L', 1, 0, 65, '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->SetFont('helvetica', '', 11);
     $pdf->MultiCell(100, 6, 'Niš, ' . date("j.n.Y"), 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 6, $dobavljac, 0, 'L', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(20, 8, "Redni broj", 'TL', 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(70, 8, "Naziv artikla", 'LT', 'C', 1, 0, 30, '', true, 0, false);
     $pdf->MultiCell(20, 8, "jm", 'LT', 'C', 1, 0, 100, '', true, 0, false);
     $pdf->MultiCell(20, 8, "kolicina", 'LT', 'C', 1, 0, 120, '', true, 0, false);
     $pdf->MultiCell(60, 8, "Opis kvara", 'LTR', 'C', 1, 0, 140, '', true, 0, false);
     $pdf->Ln();
     foreach ($rma_ids as $pos => $rbr) {
         $rma = Mage::getModel('rma/rmadevices')->load($rbr);
         $sn = $rma->getSerial() ? ' sn: ' . $rma->getSerial() : '';
         $pdf->MultiCell(20, 8, $pos + 1, 'TL', 'C', 1, 0, '', '', true, 0, false);
         $pdf->MultiCell(70, 8, $rma->getName() . $sn, 'LT', 'C', 1, 0, 30, '', true, 0, false);
         $pdf->MultiCell(20, 8, "kom", 'LT', 'C', 1, 0, 100, '', true, 0, false);
         $pdf->MultiCell(20, 8, "1", 'LT', 'C', 1, 0, 120, '', true, 0, false);
         $pdf->MultiCell(60, 8, $rma->getDescription(), 'LTR', 'C', 1, 0, 140, '', true, 0, false);
         $pdf->Ln();
         $rma->setDocumentId($broj_povratnice)->save();
     }
     $pdf->MultiCell(190, 8, "", 'T', 'C', 1, 0, '', '', true, 0, false);
     $pdf->Ln();
     $pdf->Ln();
     $pdf->MultiCell(50, 5, "", 'B', 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(20, 2, "mp", 0, 'C', 1, 0, 100, '', true, 0, false);
     $pdf->MultiCell(50, 5, "Predrag Stevanovic", 'B', 'C', 1, 0, 150, '', true, 0, false);
     $pdf->Ln();
     $pdf->MultiCell(50, 10, "robu primio", 0, 'C', 1, 0, '', '', true, 0, false);
     $pdf->MultiCell(50, 10, "robu predao", 0, 'C', 1, 0, 150, '', true, 0, false);
     // Close and output PDF document
     $pdf->IncludeJS("print();");
     //ob_clean(); //stupid tcpdf need this
     $pdf->Output(Mage::getBaseDir('media') . '/rma_pdf/' . $broj_povratnice . "-" . $dobavljac . '.pdf', 'FI');
     exit;
 }
$pdf->ComboBox('gender', 10, 5, array('', 'M', 'F'), array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
//Drink
$pdf->Cell(35, 5, 'Drink:');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Water');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Beer');
$pdf->Ln(6);
$pdf->Cell(35, 5, '');
$pdf->RadioButton('drink', 5, false);
$pdf->Cell(35, 5, 'Wine');
// set export values
$pdf->IncludeJS('fdrink.exportValues=["Water", "Beer", "Wine"];' . "\n");
// check the second radiobutton
$pdf->IncludeJS("fdrink.checkThisBox(1,true);\n");
$pdf->Ln(10);
//Gender
$pdf->Cell(35, 5, 'List:');
$pdf->ListBox('listbox', 60, 15, array('', 'item1', 'item2', 'item3', 'item4', 'item5', 'item6', 'item7'), array('multipleSelection' => 'true'));
$pdf->Ln(20);
//Adress
$pdf->Cell(35, 5, 'Address:');
$pdf->TextField('address', 60, 18, array('multiline' => true, 'strokeColor' => 'ltGray'));
$pdf->Ln(19);
//E-mail
$pdf->Cell(35, 5, 'E-mail:');
$pdf->TextField('email', 50, 5, array('strokeColor' => 'ltGray'));
$pdf->Ln(6);
    public function printpackagingslip()
    {
        $this->layout = '';
        $this->autoRender = false;
        $order = $this->getOpenOrderById('100024');
        //pr($order);
        $serviceLevel = $order['shipping_info']->PostalServiceName;
        $assignedservice = $order['assigned_service'];
        $courier = $order['courier'];
        $manifest = $order['manifest'] == 1 ? '1' : '0';
        $cn22 = $order['cn22'] == 1 ? '1' : '0';
        $barcode = $order['assign_barcode'];
        $subtotal = $order['totals_info']->Subtotal;
        $totlacharge = $order['totals_info']->TotalCharge;
        $ordernumber = $order['num_order_id'];
        $fullname = $order['customer_info']->Address->FullName;
        $address1 = $order['customer_info']->Address->Address1;
        $address2 = $order['customer_info']->Address->Address2;
        $address3 = $order['customer_info']->Address->Address3;
        $town = $order['customer_info']->Address->Town;
        $resion = $order['customer_info']->Address->Region;
        $postcode = $order['customer_info']->Address->PostCode;
        $country = $order['customer_info']->Address->Country;
        $paymentmethod = $order['totals_info']->PaymentMethod;
        $recivedate = explode('T', $order['general_info']->ReceivedDate);
        $address = $address1 . ',' . $address2 . ',' . $address3;
        App::import('Vendor', 'tcpdf/tcpdf');
        //$pdf = new tcpdf(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
        // add a page
        $resolution = array(100, 150);
        $pdf->AddPage('P', $resolution);
        $date = date("Y-m-d");
        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetHeaderData('', '', 'Service', '');
        $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
        $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
        if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
            require_once dirname(__FILE__) . '/lang/eng.php';
            $pdf->setLanguageArray($l);
        }
        $pdf->SetFont('times', '', 8);
        //$pdf->AddPage();
        $j = 0;
        $imgPath = WWW_ROOT . 'css/';
        $imageurl = Router::url('/img/source', true);
        $html = '<style>
body{margin:0px;}
#label{padding:10px; width:394px; font-size:11px; color:#000000; font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; }
#label .container{width:100%}
#label .container .header, #label .container .cn22, #label .container .footer{border-bottom:2px solid #000000; clear:both; padding:8px 4px;}
#label .container .footer{line-height:1.2}
#label .container .leftside, #label .container .rightside, #label .container .date, #label .container .sign{}
#label .container .jpoststamp{border:1px solid #000000; padding:1px;width:150px; }
#label .container .stampnumber{width: 35%; border:1px solid #000000; padding:4px; background:#000000;  color:#ffffff; text-align:center; font-size:22px; line-height:1.2}
#label .container .jerseyserial{ padding: 0 5px;    width: 65%; line-height:1; text-transform:uppercase; font-size:12px;font-weight:bold}
#label .container .vatnumber{padding: 2px 0 0 0; line-height:1.2; font-size:11px;font-weight:bold}
#label .container h1{font-family:"Oswald"; font-size:16px; margin:0px}
#label .container h3{font-size:12px;font-weight:bold; margin:0}
#label .container .rightheading{text-align:center;}
#label .container .fullwidth{clear:both}
#label .container .fullwidth h2{text-align:center; font-size:14px; font-weight:bold; margin:0; padding:5px 0;}
#label .container .fullwidth p{line-height:1.2; margin-top:5px}
#label .container .producttype{margin-bottom:5px;}

#label .container .producttype div{border-color: #000000;
border-width:1px;
border-style:solid;
    display: inline-block;
    height: 15px;
    line-height: 1.2;
    margin-right: 5px;
    text-align:center;
    width: 15px;}
	#label .container table{border:none; width:100%}
#label .container th{ font-weight:bold;font-size:12px; }
#label .container th, #label .container td{padding:2px;line-height:1.2;width:auto}
#label .container td table td{padding:0px;}
#label .container .norightborder{border-right:0px;}
#label .container .noleftborder{border-left:0px;}
#label .container .rightborder{border-right:1px solid #000000;}
#label .container .leftborder{border-left:1px solid #000000;}
#label .container .topborder{border-top:1px solid #000000;}
#label .container .bottomborder{border-bottom:1px solid #000000;}
#label .container .center{text-align:center}
#label .container .right{text-align:right}
#label .container .bold{font-weight:bold;font-size:12px; }
#label .container .sign{ margin-top: -20px;}
#label .container .barcode{padding:5px 0;}
#label .container .tracking{padding:5px 0;font-size:12px}
#label .container .address{font-size:12px}
#label .container .barcode div{font-family:"3 of 9 Barcode"; font-size:30px; margin: -5px 0;}
</style>';
        $html .= '<body>
<div id="label">
<div class="container">
<div class="header row">
<table>
<tr>
<td></td>
<td>
<table class="jpoststamp"><tr>
<td class="stampnumber">1</td>
<td class="jerseyserial">Postage Paid
Jersey
Serial 216</td>
</tr>
<tr>
<td colspan="2" class="vatnumber">UK Import VAT Pre-Paid
Auth No 393</td>
</tr>
</table>
</td>
</tr>
</table>

</div>
<div class="cn22 row">
<table>
<tr>
<td class="leftside leftheading"><h1>CUSTOMS DECLARATION</h1>
Great Britain
</td>
<td class="rightside rightheading"><h1>CN 22</h1>
May be opened officially
</td>
</tr>
</table>


<div class="fullwidth"><h2>Important!</h2></div>
<div class="producttype">
<table>
<tr>
<td><div>&nbsp;</div>Gift</td>
<td><div>&nbsp;</div>Documents</td>
<td><div>&nbsp;</div>Commercial</td>
<td><div>X</div>Merchandise</td>
</tr>
</table>

</div>
<table class="" border="1" cellpadding="5px" cellspacing="0">
<tr>
<th class="noleftborder" width="60%">Quantity and detailed description of contents</th>
<th valign="top" class="center" width="20%">Weight (kg)</th>
<th valign="top" class="center norightborder" width="20%">Value</th>
</tr>
<tr>
<td class="noleftborder">4 x Health & Nutritional Products</td>
<td valign="top" class="center">175.00</td>
<td valign="top" class="center norightborder">£79.99</td>
</tr>
<tr>
<td class="noleftborder">2 x Baby & Children\'s Health</td>
<td valign="top" class="center">75.00</td>
<td valign="top" class="center norightborder">£29.99</td>
</tr>
<tr>
<td valign="top" class="noleftborder"></td>
<td valign="top " ><table>
<tr><td class="center">P & P<br>VAT</td></tr>
</table></td>
<td valign="top " class="norightborder"><table>
<tr><td class="center">£4.99<br>£17.00</td></tr>
</table></td>
</tr>
<tr>
<td valign="top" height="100%" class="noleftborder"><table height="100%">
<tr><td><span class="bold">For commercial items only</span><br>If known, HS tariff number and country of origin of goods</td></tr>
<tr><td class="center">876534</td></tr>
</table></td>
<td valign="top" height="100%"><table height="100%">
<tr><td class="center bold">Total Weight (kg)</td></tr>
<tr><td class="center">175.00</td></tr>
</table></td>
<td valign="top" height="100%"  class="norightborder"><table height="100%">
<tr><td class="center bold">Total Value</td></tr>
<tr><td class="center">£101.98</td></tr>
</table></td>
</tr>
</table>
<div class="fullwidth"><p>I the undersigned, whose name and address are given on the item, certify that the particulars given in this declaration are correct and that this item does not contain any dangerous article or articles prohibited by legislation or by postal or customs regulations.</p>
<div class="date bold">Date: 22 Sep. 2015</div>
<div class="sign right"></div>
</div>
</div>
<div class="footer row">

<table>
<tr>
<td class="leftside leftheading address"><h3>SHIP TO:</h3>
<span class="bold">Mr Test Customer</span><br>
Address Line 1 Address Line 2 <br>
Some Town Some Region<br>
123 ABC<br>
United Country<br>
</td>
<td class="rightside rightheading leftborder">
<div class="tracking bottomborder"><h3>TRACKING #:</h3>
1Z A90 26X 03 9015 6318
</div>
<div class="barcode center">Purchase Order<div>4584327-0</div>4584327-0</div>
</td>
</tr>
</table>
</div>
<div class="footer row"><span class="bold">If undelivered please return to:</span> Unit 4, Cargo Centre, Jersey Airport, L’Avenue de la Commune, St Peter, JE3 7BY</div>

</div>
</div>

</body>';
        //$html .= '<style>'.file_get_contents($imgPath.'packing.css').'</style>';
        //echo $html;
        $pdf->writeHTML($html, true, false, true, false, '');
        $js = 'print(true);';
        $pdf->IncludeJS($js);
        $pdf->Output('Service_' . $date . '.pdf', 'D');
    }
Example #15
0
<?php

// create new PDF document
include_once 'tcpdf/tcpdf.php';
// new object
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->IncludeJS('rapportEcophile.js');
// set document information
$pdf->SetCreator('TCPDF');
$pdf->SetAuthor('ERDF');
$pdf->SetTitle('Suivi de consommation');
$pdf->SetSubject('Suivi de consommation');
// set default header data
$pdf->SetHeaderData('linky.jpg', 30, 'Suivi de consommation', "Recapitulatif\nwww.erdf.fr", array(2, 64, 128));
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(10);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// 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);