Skip to content

Commit

Permalink
Merge pull request #31 from rospdf/recovered-addtextwrap
Browse files Browse the repository at this point in the history
recovered method addTextWrap and corrected windows temp path
  • Loading branch information
ole1986 committed Jun 1, 2016
2 parents 64123db + 787b7c2 commit 140b998
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 11 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor
/.vscode
5 changes: 5 additions & 0 deletions data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Note that this document was generated using the demo script 'readme.php' which c

1<Changes>

2<0.12.22>

- recovered the addTextWrap method
- corrected temp path for windows systems using php-cgi

2<0.12.21>

- added image rotation support
Expand Down
2 changes: 1 addition & 1 deletion examples/encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$pdf = new Cezpdf('a4','portrait');
// to test on windows xampp
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'E:/xampp/xampp/tmp';
$pdf->tempPath = 'C:/temp';
}

if(!isset($_GET['nocrypt'])){
Expand Down
6 changes: 3 additions & 3 deletions examples/fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ function Creport($p,$o){
}
$pdf = new Creport('a4','portrait');
// to test on windows xampp
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'E:/xampp/xampp/tmp';
}
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'C:/temp';
}

$pdf->ezSetMargins(20,20,20,20);
$pdf->openHere('Fit');
Expand Down
2 changes: 1 addition & 1 deletion examples/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Creport($p,$o){
$pdf = new Creport('a4','portrait');
// to test on windows xampp
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'E:/xampp/xampp/tmp';
$pdf->tempPath = 'C:/temp';
}

$pdf -> ezSetMargins(20,20,20,20);
Expand Down
11 changes: 9 additions & 2 deletions examples/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function Creport($p,$o){
}
}
$pdf = new Creport('a4','portrait');
// to test on windows xampp
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'C:/temp';
}
// make sure cache is regenerated
$pdf->cacheTimeout = 0;

Expand All @@ -24,10 +28,13 @@ function Creport($p,$o){
$pdf->openHere('Fit');

$pdf->selectFont('Helvetica');
for($i = 1; $i <= 1; $i++){
$pdf->ezText("Lorem $ £ € ipsum dol $i");
$result = '';
for($i = 1; $i <= 50; $i++){
$result.='Lorem ipsum dol sit ';
}

$pdf->addTextWrap(100, 600,10,$result, 250, 'full');

if (isset($_GET['d']) && $_GET['d']){
$pdfcode = $pdf->ezOutput(1);
$pdfcode = str_replace("\n","\n<br>",htmlspecialchars($pdfcode));
Expand Down
Binary file modified readme.pdf
Binary file not shown.
9 changes: 5 additions & 4 deletions readme.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ function dots($info){
// this code has been modified to use ezpdf.

$project_url = "http://pdf-php.sf.net";
$project_version = "0.12.21";
$project_version = "0.12.22";

$pdf = new Creport('a4','portrait', 'none', null);
// to test on windows xampp
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'E:/xampp/xampp/tmp';
}
if(strpos(PHP_OS, 'WIN') !== false){
$pdf->tempPath = 'C:/temp';
}

$start = microtime(true);

// IMPORTANT: To allow custom callbacks being executed
Expand Down
7 changes: 7 additions & 0 deletions src/Cpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3078,6 +3078,13 @@ public function addText($x, $y, $size, $text, $width = 0, $justification = 'left
return '';
}

public function addTextWrap($x, $y, $size, $text, $width = 0, $justification = 'left', $angle = 0, $wordSpaceAdjust = 0, $test=0){
while($text) {
$text = $this->addText($x, $y, $size, $text, $width, $justification, $angle, $wordSpaceAdjust, $test);
if($text) $y-= $this->getFontHeight($size);
}
}

/*
* unicode version of php ord to get the decimal of an utf-8 character
*/
Expand Down

0 comments on commit 140b998

Please sign in to comment.