Create a PDF document template: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
(Update the path to the TCPDF lib.)
mNo edit summary
Tag: 2017 source edit
Line 100: Line 100:
*Add following instructions
*Add following instructions


<source lang="php">
<syntaxHighlight lang="php">
$pdf->Image('\www\htdocs\dolibarr\document\societe\logo.jpg', 10, 5, 60.00);
$pdf->Image('\www\htdocs\dolibarr\document\societe\logo.jpg', 10, 5, 60.00);
</source>
</syntaxHighlight>
With this example: 10=abscissa, 5=ordinate, 60=with of logo
With this example: 10=abscissa, 5=ordinate, 60=with of logo


Line 109: Line 109:
===Insert text===
===Insert text===
Most common function to use
Most common function to use
<source lang="php">
<syntaxHighlight lang="php">
$pdf->setX(float a); // set current x position
$pdf->setX(float a); // set current x position
$pdf->setY(float b); // set current y position
$pdf->setY(float b); // set current y position
Line 116: Line 116:
$pdf->SetFont('Arial','B',14); // fixe la police, le type ( 'B' pour gras, 'I' pour italique, '' pour normal,...)
$pdf->SetFont('Arial','B',14); // fixe la police, le type ( 'B' pour gras, 'I' pour italique, '' pour normal,...)
$pdf->MultiCell(60, 8, 'Mon texte", 0, 'L'); // imprime 'Mon texte' avec saut de ligne
$pdf->MultiCell(60, 8, 'Mon texte", 0, 'L'); // imprime 'Mon texte' avec saut de ligne
</source>
</syntaxHighlight>
Note: Origin for setXY functions are the top left corner of page.
Note: Origin for setXY functions are the top left corner of page.


===Add a PDF Annotation (comment)===
===Add a PDF Annotation (comment)===
''Left side of the page around the middle:''
''Left side of the page around the middle:''
<source lang="php">
<syntaxHighlight lang="php">
$pdf->Annotation(102, 202, 10, 10, "this is the comment text", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'this is comment author', 'Subj' => 'this is comment title', 'C' => array(255, 255, 0)));
$pdf->Annotation(102, 202, 10, 10, "this is the comment text", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'this is comment author', 'Subj' => 'this is comment title', 'C' => array(255, 255, 0)));
</source>
</syntaxHighlight>


''Right side of the page around the middle:''
''Right side of the page around the middle:''
<source lang="php">
<syntaxHighlight lang="php">
$pdf->Annotation(202, 102, 10, 10, "this is the comment text", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'this is comment author', 'Subj' => 'this is comment title', 'C' => array(255, 255, 0)));
$pdf->Annotation(202, 102, 10, 10, "this is the comment text", array('Subtype'=>'Text', 'Name' => 'Comment', 'T' => 'this is comment author', 'Subj' => 'this is comment title', 'C' => array(255, 255, 0)));
</source>
</syntaxHighlight>


===Add Complementary Attribute (extrafiled)===
===Add Complementary Attribute (extrafiled)===

Navigation menu