require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('John Doe'); $pdf->SetTitle('Sample PDF'); $pdf->SetSubject('Demo'); $pdf->SetKeywords('PDF, demo, TCPDF, PHP'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $html = 'Hello, world!
'; $pdf->writeHTML($html, true, false, true, false, ''); $pdf->Output('sample.pdf', 'D');
require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('John Doe'); $pdf->SetTitle('Sample PDF'); $pdf->SetSubject('Demo'); $pdf->SetKeywords('PDF, demo, TCPDF, PHP'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); $image = 'sample.jpg'; $pdf->Image($image, $x = 15, $y = 15, $w = 180, $h = 240, $type = '', $link = '', $align = '', $resize = true, $dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false, $hidden = false, $fitonpage = false, $alt = '', $capt = '', $linkypos = ''); $pdf->Output('sample.pdf', 'D');The package library used in the examples is TCPDF.