Форматиране на изображение и текст в TCPDF

Използване на TCPDF за генериране на моя HTML в PDF. Но форматирането на текст не идва и изображението не присъства в PDF. Какъв е проблема. ?

PHP код:

require_once('tcpdf/tcpdf.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);
// set default header data
// $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 021', 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)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
    require_once(dirname(__FILE__).'/lang/eng.php');
    $pdf->setLanguageArray($l);
}

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

// add a page
$pdf->AddPage();
// create some HTML content

/*---------*/
$html  = 'HTML Content Which is pasted under the HTML head in this Question'; 

// output the HTML content
$pdf->writeHTML($html, true, 0, true, 0);

// reset pointer to the last page
$pdf->lastPage();
ob_end_clean();
//Close and output PDF document
$pdf->Output('rec_users.pdf','D');

HTML

<table>
        <tbody>
            <tr>
                <td style='background:red'>&nbsp;</td>

                <td><img alt='' height='129' src=
                'demo-300x300.jpg'
                width='300'></td>

                <td>
                    <div class='header'>
                        <div class='right'>
                            <p>1790 lee Travino</p>

                            <p>CL paso xyz</p>

                            <p>T-123456789</p>

                            <p>F-45678903</p>

                            <p>wwww.xyz.com</p>
                        </div>
                    </div>
                </td>
            </tr>

            <tr>
                <td style='background:red'>&nbsp;</td>

                <td>
                    <div class='letter_section'>
                        <h1>Service Agreement</h1>

                        <p style=
                        'color: #5d605f; font-family: arial; font-size: 20px; margin: 40px 0;'>
                        December 30,2013</p>

                        <h3 class='address'>Ms.jenifer Carter</h3>

                        <h3 class='address'>Ms.jenifer Carter</h3>

                        <h3 class='address'>Ms.jenifer Carter</h3>

                        <h3 class='address'>Ms.jenifer Carter</h3>

                        <h3 class='address'>Ms.jenifer Carter</h3>
                    </div>
                </td>

                <td>&nbsp;</td>
            </tr>

            <tr>
                <td style='background:red'>&nbsp;</td>

                <td colspan='2'>
                    <p>lorem ipum is the dolor sit amet lorem ipum is the dolor
                    sit amet lorem ipum is the dolor sit ametlorem ipum is the
                    dolor sit ametlorem ipum is the dolor sit amet lorem ipum
                    is the dolor sit amet lorem ipum is the dolor sit amet</p>

                    <p>lorem ipum is the dolor sit amet lorem ipum is the dolor
                    sit amet lorem ipum is the dolor sit ametlorem ipum is the
                    dolor sit ametlorem ipum is the dolor sit amet lorem ipum
                    is the dolor sit ametlorem ipum is the dolor sit amet lorem
                    ipum is the dolor sit amet lorem ipum is the dolor sit
                    ametlorem ipum is the dolor sit ametlorem ipum is the dolor
                    sit amet lorem ipum is the dolor sit amet</p>
                </td>
            </tr>
        </tbody>
    </table>

Необходим изход:

въведете описание на изображението тук


person Puzzled Boy    schedule 27.11.2014    source източник
comment
И така, вие показахте кода и желания изход, все пак трябва да ни покажете какво всъщност получавате във вашия изход, за да знаем какво да гледаме.   -  person Duniyadnd    schedule 27.11.2014


Отговори (1)


1) Проверете пътя на изображението .. Потвърдете изображението в дадения път. 2) За отпечатване на изображение вижте следния код

$pdf->Изображение($image_path.'imageName.jpg',$x_im+32.8,$y_im+32,$w_im,$h_im);

person user2148134    schedule 28.11.2014