SetMargins() 공개 메소드

public SetMargins ( $left, $top, $right = null )
예제 #1
0
 /**
  * Creates content that should be printed
  *
  * @param Collection $collection
  * @return string
  */
 public function renderCollectionContent($collection)
 {
     $pdf = new \tFPDF('P', 'mm', [72, 80]);
     $pdf->SetMargins(0, 2);
     // Запретим автоматический разрыв страниц
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->AddPage();
     $pdf->AddFont('arial', '', 'arial.ttf', true);
     $pdf->AddFont('arialbd', '', 'arialbd.ttf', true);
     $this->makeLine($pdf, Settings::get()->terminalName(), 10, 5)->makeLine($pdf, date('H:i:s d.m.Y', time()), 10, 5)->makeLine($pdf, $collection->sum . ' руб.', 16, 15, true)->makeLine($pdf, 'Инкассация:', 10, 10)->makeLine($pdf, (string) $collection->id, 12, 5)->makeLine($pdf, Settings::get()->contactInfo(), 8, 15)->makeLine($pdf, 'Сохраняйте чек', 8, 4);
     $fileName = __DIR__ . '/../runtime/pdf/collection_ticket.pdf';
     $pdf->Output($fileName, 'F');
     return $fileName;
 }
{
	global $pdf, $fbgname;
	$pdf->AddPage();
	if (isset($_GET["b"]) && $fbgname)
		$pdf->Image($fbgname,5,5,287,200);
	if (isset($_GET["t"]))
		parseText($text, $competitor,$position,$event,$score);
}

if (substr($_SERVER["REQUEST_URI"],0,6)=="/beta/")
	require_once "../".DIR_FPDF;
else
	require_once DIR_FPDF;

$pdf = new tFPDF("L");
$pdf->SetMargins(50,50,50);
$pdf->AddFont(SERIF,"","DejaVuSerif.ttf",true);
$pdf->AddFont(SERIF,"B","DejaVuSerif-Bold.ttf",true);
$pdf->AddFont(SANS,"","DejaVuSans.ttf", true);
$pdf->AddFont(SANS,"B","DejaVuSans-Bold.ttf", true);

$fname = "tpt_".$_SESSION["c_id"];
$template = readTemplate($fname,$dummy);
if ($template)
	$text = $template->txt;
else
{
	$fname = defaultTemplateLanguage();
	$template = readTemplate($fname,$dummy);
	if (!$template) 
		die("Impossible to load a valid template");