$pdf = new TCPDF(); $pdf->AddPage(); $pdf->SetFont('helvetica', '', 12); $pdf->SetY(50); $pdf->Cell(0, 0, 'This text will start at 50mm from the top of the page'); $pdf->Output();
$pdf = new FPDF(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 10); $pdf->SetFillColor(255, 0, 0); $pdf->SetY(30); $pdf->Cell(20, 10, '', 1, 0, 'C', true); $pdf->Output();In this example, the SetY function is used to position the insertion point before drawing a filled rectangle on the PDF document using the Cell function. The package library used for these examples is TCPDF/FDPF, which are popular PHP libraries for creating PDF documents.