1
This commit is contained in:
92
vendor/tecnickcom/tcpdf/examples/example_013.php
vendored
92
vendor/tecnickcom/tcpdf/examples/example_013.php
vendored
@@ -31,29 +31,29 @@ require_once('tcpdf_include.php');
|
||||
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||
|
||||
// set document information
|
||||
$pdf->SetCreator(PDF_CREATOR);
|
||||
$pdf->SetAuthor('Nicola Asuni');
|
||||
$pdf->SetTitle('TCPDF Example 013');
|
||||
$pdf->SetSubject('TCPDF Tutorial');
|
||||
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
|
||||
$pdf->setCreator(PDF_CREATOR);
|
||||
$pdf->setAuthor('Nicola Asuni');
|
||||
$pdf->setTitle('TCPDF Example 013');
|
||||
$pdf->setSubject('TCPDF Tutorial');
|
||||
$pdf->setKeywords('TCPDF, PDF, example, test, guide');
|
||||
|
||||
// set default header data
|
||||
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', PDF_HEADER_STRING);
|
||||
$pdf->setHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 013', 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);
|
||||
$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);
|
||||
$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);
|
||||
$pdf->setAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
|
||||
|
||||
// set image scale factor
|
||||
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
||||
@@ -67,7 +67,7 @@ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
|
||||
// ---------------------------------------------------------
|
||||
|
||||
// set font
|
||||
$pdf->SetFont('helvetica', 'B', 20);
|
||||
$pdf->setFont('helvetica', 'B', 20);
|
||||
|
||||
// add a page
|
||||
$pdf->AddPage();
|
||||
@@ -75,15 +75,15 @@ $pdf->AddPage();
|
||||
$pdf->Write(0, 'Graphic Transformations', '', 0, 'C', 1, 0, false, false, 0);
|
||||
|
||||
// set font
|
||||
$pdf->SetFont('helvetica', '', 10);
|
||||
$pdf->setFont('helvetica', '', 10);
|
||||
|
||||
// --- Scaling ---------------------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(50, 70, 40, 10, 'D');
|
||||
$pdf->Text(50, 66, 'Scale');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// Scale by 150% centered by (50,80) which is the lower left corner of the rectangle
|
||||
@@ -94,12 +94,12 @@ $pdf->Text(50, 66, 'Scale');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Translation -----------------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(125, 70, 40, 10, 'D');
|
||||
$pdf->Text(125, 66, 'Translate');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// Translate 7 to the right, 5 to the bottom
|
||||
@@ -110,12 +110,12 @@ $pdf->Text(125, 66, 'Translate');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Rotation --------------------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(70, 100, 40, 10, 'D');
|
||||
$pdf->Text(70, 96, 'Rotate');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// Rotate 20 degrees counter-clockwise centered by (70,110) which is the lower left corner of the rectangle
|
||||
@@ -126,12 +126,12 @@ $pdf->Text(70, 96, 'Rotate');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Skewing ---------------------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(125, 100, 40, 10, 'D');
|
||||
$pdf->Text(125, 96, 'Skew');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// skew 30 degrees along the x-axis centered by (125,110) which is the lower left corner of the rectangle
|
||||
@@ -142,12 +142,12 @@ $pdf->Text(125, 96, 'Skew');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Mirroring horizontally ------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(70, 130, 40, 10, 'D');
|
||||
$pdf->Text(70, 126, 'MirrorH');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// mirror horizontally with axis of reflection at x-position 70 (left side of the rectangle)
|
||||
@@ -158,12 +158,12 @@ $pdf->Text(70, 126, 'MirrorH');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Mirroring vertically --------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(125, 130, 40, 10, 'D');
|
||||
$pdf->Text(125, 126, 'MirrorV');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// mirror vertically with axis of reflection at y-position 140 (bottom side of the rectangle)
|
||||
@@ -174,12 +174,12 @@ $pdf->Text(125, 126, 'MirrorV');
|
||||
$pdf->StopTransform();
|
||||
|
||||
// --- Point reflection ------------------------------------
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(70, 160, 40, 10, 'D');
|
||||
$pdf->Text(70, 156, 'MirrorP');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
// Start Transformation
|
||||
$pdf->StartTransform();
|
||||
// point reflection at the lower left point of rectangle
|
||||
@@ -196,7 +196,7 @@ $py=170;
|
||||
|
||||
// just for visualisation: the straight line to mirror against
|
||||
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->Line($px-1,$py-1,$px+1,$py+1);
|
||||
$pdf->Line($px-1,$py+1,$px+1,$py-1);
|
||||
$pdf->StartTransform();
|
||||
@@ -204,12 +204,12 @@ $pdf->Rotate($angle, $px, $py);
|
||||
$pdf->Line($px-5, $py, $px+60, $py);
|
||||
$pdf->StopTransform();
|
||||
|
||||
$pdf->SetDrawColor(200);
|
||||
$pdf->SetTextColor(200);
|
||||
$pdf->setDrawColor(200);
|
||||
$pdf->setTextColor(200);
|
||||
$pdf->Rect(125, 160, 40, 10, 'D');
|
||||
$pdf->Text(125, 156, 'MirrorL');
|
||||
$pdf->SetDrawColor(0);
|
||||
$pdf->SetTextColor(0);
|
||||
$pdf->setDrawColor(0);
|
||||
$pdf->setTextColor(0);
|
||||
//Start Transformation
|
||||
$pdf->StartTransform();
|
||||
//mirror against the straight line
|
||||
|
||||
Reference in New Issue
Block a user