HEX
Server: Apache
System: Linux v38079.2is.nl 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: democfellows (10015)
PHP: 8.1.34
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/creativefellows.nl/jhtaxatie.creativefellows.nl/classes/LabelPdf.php
<?php

require_once "../classes/pdf-generator/TCPDF-master/tcpdf.php";
require_once "../classes/pdf-generator/FPDI-1.4.4/fpdi.php";

/**
 * Pdf Reader Service
 */
class LabelPdf
{
 	
	protected $row_witdh = 90;
	protected $cell_height = null;
	
   	public function __construct($font_folder,$args)
	{
		$this->font_folder 	= $font_folder; 
		
		
		// initiate PDF
		$this->pdf = new Pdf();
		$this->pdf->SetMargins(5, 5, 5);
		
		// set document information
		$this->pdf->SetCreator("");
		$this->pdf->SetAuthor("");
		$this->pdf->SetTitle("");
		$this->pdf->SetSubject("");
		$this->pdf->SetKeywords("");

		// set default header data
		$this->pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 010', PDF_HEADER_STRING);

		// set header and footer fonts
		$this->pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
		$this->pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

		// set default monospaced font
		$this->pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

	
		// set auto page breaks
		$this->pdf->SetAutoPageBreak(TRUE, 0);
		$this->pdf->setCellHeightRatio(1.5);
		
		$this->pdf->setCellPaddings(1,0.5,1,0.5);
		

		// gray border for tables
		$this->pdf->SetLineStyle(array('width' => 0.125,'color' => array(0, 0, 0, 255)));
   		
		// set fonts
		$this->font_light 	= TCPDF_FONTS::addTTFfont('MuseoSans-300.ttf');
		$this->font_bold 	= TCPDF_FONTS::addTTFfont('MuseoSans-700.ttf');
		
		$this->args = $args;
	}
	
	public function setSourceFile($pdf_source)
	{
		$this->pdf_source = $pdf_source;
	}
	
	function setLightFont($size=8.5)
	{
		$this->pdf->SetFont($this->font_light ,"",$size,'',false);	
	}
	
	function setBoldFont($size=8.5)
	{
		$this->pdf->SetFont($this->font_bold ,"",$size,'',false);	
	}
		
	
	public function create()
	{
		// new page
		$this->pdf->AddPage('P',[100,150]);
			
		// type, build, order, number
		/*$this->setBoldFont(9);
		$this->pdf->Cell(24, $this->cell_height, "Type", "TB", 0, '', false);

		$this->setLightFont(8);
		$this->pdf->Cell(22.5, $this->cell_height, "E", "TB", 0, '', false);
		
		$this->setBoldFont(9);
		$this->pdf->Cell(24, $this->cell_height, "Bouwjaar", "TB", 0, '', false);

		$this->setLightFont(8);
		$this->pdf->Cell(22.5, $this->cell_height, "2000", "TB", 1, '', false);
		
		$this->setBoldFont(9);
		$this->pdf->Cell(24, $this->cell_height, "Ordernummer", "TB", 0, '', false);

		$this->setLightFont(8);
		$this->pdf->Cell(22.5, $this->cell_height, "987654321", "TB", 0, '', false);
		
		$this->setBoldFont(9);
		$this->pdf->Cell(24, $this->cell_height, "Volgnummer", "TB", 0, '', false);

		$this->setLightFont(8);
		$this->pdf->Cell(22.5, $this->cell_height, "01", "TB", 1, '', false);
			
		// liggers
		$this->setBoldFont(9);
		$this->pdf->Cell(90, $this->cell_height, "Liggerafstand (h)", 'TB', 1, '', false);			*/
		
		$this->pdf->setFillColor(0,0,0,10);
		
		$this->setBoldFont(9);
		
		$this->pdf->Cell(22.5, $this->cell_height, "Type", "TB", 0, '', true);
		$this->pdf->Cell(22.5, $this->cell_height, "Bouwjaar", "TB", 0, '', true);
		$this->pdf->Cell(22.5, $this->cell_height, "Ordernummer", "TB", 0, '', true);
		$this->pdf->Cell(22.5, $this->cell_height, "Volgnummer", "TB", 1, '', true);

		$this->setLightFont(8);
		$this->pdf->Cell(22.5, $this->cell_height, "E", "TB", 0, '', false);
		$this->pdf->Cell(22.5, $this->cell_height, "2000", "TB", 0, '', false);
		$this->pdf->Cell(22.5, $this->cell_height, "987654321", "TB", 0, '', false);
		$this->pdf->Cell(22.5, $this->cell_height, "01", "TB", 1, '', false);
			
		// liggers
		$this->setBoldFont(9);
		$this->pdf->Cell(90, $this->cell_height, "Liggerafstand (h)", 'TB', 1, '', true);			
			

		$this->setLightFont(8);
		for($i=0; $i < $this->args["ligger_count"]; $i++)
		{
			$ln = ($i & 1) ? 1 : 0;
			$border_left = ($i & 1) ? "" : "";
			$border_right = ($i & 1) ? "" : "R";
			
			$this->pdf->writeHTMLCell(22.5, 0, null, null, ($i+1)."<sup>e</sup> Ligger", $border_left);
			$this->pdf->writeHTMLCell(22.5, 0, null, null, "1550 mm", $border_right, $ln,false,true,"");
		
		}
		
		if ($i & 1){
			$this->pdf->writeHTMLCell(45, 0, null, null, "", "", 1);	
		}
		
		
		$this->setBoldFont(9);

		$this->pdf->Cell(22.5, 0, "Type", "TB", 0, '', true);
		$this->pdf->Cell(22.5, 0, "Lengte (l)", "TB", 0, '', true);
		$this->pdf->Cell(22.5, 0, "Pallet", "TB", 0, '', true);
		$this->pdf->Cell(22.5, 0, "Gewicht", "TB", 1, '', true);
		
		

		$this->setLightFont(8);
		
		for($i=0; $i < $this->args["ligger_type_count"]; $i++)
		{
			$this->pdf->writeHTMLCell(22.5, 0, null, null, "GNA 116.55", "", 0);
			$this->pdf->writeHTMLCell(22.5, 0, null, null, "3600 mm", "", 0);
			$this->pdf->writeHTMLCell(22.5, 0, null, null, "496,5 kg", "", 0);
			$this->pdf->writeHTMLCell(22.5, 0, null, null, "1986 kg", "", 1,false,true,"");
		}
		
	
		$this->setBoldFont(9);
		$this->pdf->writeHTMLCell(45, 0, null, null, "Maximale veldlast<sup>*</sup>", "T",0,true);
		$this->pdf->writeHTMLCell(45, 0, null, null, "Staandertype", "T",1,true);
		
		$this->setLightFont(8);
		$this->pdf->writeHTMLCell(45, 0, null, null, "5972 kg", "T", 0);
		$this->pdf->writeHTMLCell(45, 0, null, null, "MX610.1100.3600", "T", 1);
		
		$this->setBoldFont(9);
		$this->pdf->writeHTMLCell(45, 0, null, null, "Klantnaam", "T",0,true);
		$this->pdf->writeHTMLCell(45, 0, null, null, "Locatie", "T",1,true);
		
		$this->setLightFont(8);
		$this->pdf->writeHTMLCell(45, 0, null, null, "Creative Fellows B.V.", "T", 0,false,true,"");
		$this->pdf->writeHTMLCell(45, 0, null, null, "Buitenruimte", "T", 1,false,true,"");
			
		$this->setBoldFont(9);
		$this->pdf->writeHTMLCell(90, 0, null, null, "Opmerkingen", "T",1,true);
		$this->setLightFont(8);
		$this->pdf->writeHTMLCell(90, 0, null, null, "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sunt exercitation laboris quis duis mollit velit commodo cupidatat pariatur tempor officia cupidatat esse magna reprehenderit laboris excepteur laborum proident velit quis occaecat non mollit consectetur ut labore ea dolore aliqua culpa.", "T", $ln,false,true,"");
		
		$this->setLightFont(7);
		$this->pdf->writeHTMLCell(90, 0, null, null, "* Bij gelijkmatig verdelen belasting", "T", 1,false,true,"");
		
		$this->addPage(1);	
		
		header("Content-type: application/pdf");
		$this->pdf->Output("test.pdf","I");
		die();
		
		
		
		return $this->pdf->Output('test.pdf', 'I');
		
	}
	
	public function addPage(int $template_page)
	{
		
		$this->pdf->setSourceFile($this->pdf_source);

		$index 	= $this->pdf->ImportPage($template_page, '/MediaBox');
		$size 	= $this->pdf->getTemplatesize($index);
		
		$this->pdf->AddPage('P',[$size["w"],$size["h"]]);
		$this->pdf->useTemplate($index);
		
	}
	
	
		
		
	private function tableRow($columns, array $values){
		
		for($i=0; $i < $columns; $i++)
		{
		
			$this->pdf->Cell($this->row_witdh/$columns, $this->cell_height, $values[$i], 'LTR', 0, '', false);			
			
			
			//$pdf->Cell(30, 0, 'LTRB', 'LTRB', 1, 'C', 1, '', 0, false, 'T', 'C');
			
			
			
		}
		
	}
	
}