Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

class.ezpdftable.php
Go to the documentation of this file.
1 <?php
17 class eZPDFTable extends Cezpdf
18 {
19 public $fontSize;
20 const NEWLINE = '<C:callNewLine>';
21 const SPACE = '<C:callSpace>';
22 const TAB = '<C:callTab>';
23
24 const PAGENUM = '#page';
25 const TOTAL_PAGENUM = '#total';
26 const HEADER_LEVEL = '#level';
27 const HEADER_LEVEL_INDEX = '#indexLevel';
28
37 function __construct($paper='a4',$orientation='portrait')
38 {
39 parent::__construct( $paper, $orientation );
40 $this->TOC = array();
41 $this->KeywordArray = array();
42 $this->PageCounter = array();
43 $this->initFrameMargins();
44
45 $this->ez['textStack'] = array();
46
47 $this->PreStack = array();
48 $this->DocSpecification = array();
49 $this->pushStack();
50 $this->FrontpageID = null;
51 }
52
58 function eZPDFTable($paper='a4',$orientation='portrait')
59 {
60 self::__construct($paper,$orientation);
61 }
62
67 function initFrameMargins()
68 {
69 $this->ezFrame = array();
70
71 $config = eZINI::instance( 'pdf.ini' );
72
73 $this->ezFrame['header'] = array( 'y0' => $this->ez['pageHeight'],
74 'leftMargin' => $config->variable( 'Header', 'LeftMargin' ),
75 'rightMargin' => $config->variable( 'Header', 'RightMargin' ),
76 'topMargin' => $config->variable( 'Header', 'TopMargin' ),
77 'bottomMargin' => $config->variable( 'Header', 'BottomMargin' ) );
78 $this->ezFrame['footer'] = array( 'y0' => $this->ez['bottomMargin'],
79 'leftMargin' => $config->variable( 'Footer', 'LeftMargin' ),
80 'rightMargin' => $config->variable( 'Footer', 'RightMargin' ),
81 'topMargin' => $config->variable( 'Footer', 'TopMargin' ),
82 'bottomMargin' => $config->variable( 'Footer', 'BottomMargin' ) );
83 }
84
88 function yOffset()
89 {
90 return $this->y;
91 }
92
96 function xOffset()
97 {
98 $xOffset = $this->ez['xOffset'];
99 if ( $xOffset == 0 ||
100 $this->leftMargin() > $this->ez['xOffset'] )
101 {
102 $xOffset = $this->leftMargin();
103 }
104 return $xOffset;
105 }
106
107 function setYOffset( $yOffset )
108 {
109 $this->y = $yOffset;
110 }
111
112 function setXOffset( $xOffset )
113 {
114 if ( $xOffset > $this->ez['pageWidth'] - $this->rightMargin() )
115 {
116 $this->ez['xOffset'] = 0;
117 }
118 else
119 {
120 $this->ez['xOffset'] = $xOffset;
121 }
122 }
123
168 function ezTable(&$data,$cols='',$title='',$options='')
169 {
170 if (!is_array($data)){
171 return;
172 }
173
174 $tableStartY = $this->y;
175
176 // Get total column count and column indexes
177 if (!is_array($cols)){
178 // take the columns from the first row of the data set
179 reset($data);
180 $k=key($data);
181 $v=current($data);
182 if (!is_array($v)){
183 return;
184 }
185 $cols=array();
186
187 $realCount = 0;
188 for ( $c = 0; $c < count($v); $c++ )
189 {
190 if ( isset( $options['cellData'][$realCount.',0']['size'] ) )
191 {
192 $incCount = $options['cellData'][$realCount.',0']['size'];
193 for ( $innerCount = 0; $innerCount < $incCount; ++$innerCount )
194 {
195 $cols[$realCount] = $realCount++;
196 }
197 }
198 else
199 {
200 $cols[$realCount] = $realCount++;
201 }
202 }
203 }
204
205 if (!is_array($options)){
206 $options=array();
207 }
208
209 $defaults = array(
210 'cellPadding' => 0,
211 'shaded' => 0,
212 'showLines' => 1,
213 'shadeCol' => eZMath::rgbToCMYK2( 0.8, 0.8, 0.8 ),
214 'shadeCol2' => eZMath::rgbToCMYK2( 0.7, 0.7, 0.7 ),
215 'repeatTableHeader' => 0,
216 'fontSize' => 10,
217 'titleGap' => 5,
218 'lineCol' => array( 0, 0, 0 ),
219 'gap' => 5,
220 'xPos' => 'centre',
221 'xOrientation' => 'centre',
222 'showHeadings' => 1,
223 'textCol' => eZMath::rgbToCMYK2( 0, 0, 0 ),
224 'titleTextCMYK' => eZMath::rgbToCMYK2( 0, 0, 0 ),
225 'width' => 0,
226 'maxWidth' => 0,
227 'cols' => array(),
228 'minRowSpace' => -100,
229 'rowGap' => 2,
230 'colGap' => 5,
231 'innerLineThickness' => 1,
232 'outerLineThickness' => 1,
233 'splitRows' => 0,
234 'protectRows'=> 1,
235 'firstRowTitle' => false,
236 'titleFontSize' => 10,
237 'test' => 0,
238 'yBottom' => 0 );
239
240 foreach($defaults as $key=>$value){
241 if (is_array($value)){
242 if (!isset($options[$key]) || !is_array($options[$key])){
243 $options[$key]=$value;
244 }
245 } else {
246 if (!isset($options[$key])){
247 $options[$key]=$value;
248 }
249 }
250 }
251 $options['gap']=2*$options['colGap'];
252 $middle = ($this->ez['pageWidth']- $this->rightMargin() - $this->leftMargin() )/2+$this->leftMargin();
253 // figure out the maximum widths of the text within each column
254 $maxWidth = array();
255 $minWidth = array();
256
257 $maxRowCount = 0;
258 // find the maximum cell widths based on the data
259 foreach ( $data as $rowCount=>$row)
260 {
261 $realColCount = 0;
262 for( $columnCount = 0; $columnCount < count( $row ); $columnCount++ )
263 {
264 $wMax = 0; // total maximum width of table column
265 $wMix = 0; // minimum width of table column
266 $data[$rowCount][$columnCount] = $this->fixupTableCellText( $row[$columnCount] );
267 $row[$columnCount] = $data[$rowCount][$columnCount];
268 // get col span
269 $colSpan = 1;
270 if ( isset( $options['cellData'][$realColCount.','.$rowCount]['size'] ) )
271 {
272 $colSpan = $options['cellData'][$realColCount.','.$rowCount]['size'];
273 }
274
275 //get and set max width
276 if ( ( $rowCount == 0 && $options['firstRowTitle'] ) ||
277 ( isset( $options['cellData'][$realColCount.','.$rowCount]['title'] ) && $options['cellData'][$realColCount.','.$rowCount]['title'] ) )
278 {
279 $wMax = $this->ezPrvtGetTextWidth( $options['titleFontSize'], (string)$row[$columnCount] ) * 1.01;
280 $wMin = $this->eZGetMaxWordWidth( $options['titleFontSize'], (string)$row[$columnCount] ) * 1.01;
281 $options['cellData'][$realColCount.','.$rowCount]['title'] = true;
282 }
283 else
284 {
285 $wMax = $this->ezPrvtGetTextWidth( $options['fontSize'], (string)$row[$columnCount] ) * 1.01;
286 $wMin = $this->eZGetMaxWordWidth( $options['fontSize'], (string)$row[$columnCount] ) * 1.01;
287 }
288
289 if ( isset( $maxWidth[$colSpan][$realColCount] ) )
290 {
291 if ( $wMax > $maxWidth[$colSpan][$realColCount] )
292 {
293 $maxWidth[$colSpan][$realColCount] = $wMax;
294 }
295 }
296 else
297 {
298 if ( !isset( $maxWidth[$colSpan] ) )
299 {
300 $maxWidth[$colSpan] = array();
301 }
302 $maxWidth[$colSpan][$realColCount] = $wMax;
303 }
304
305 if ( isset( $minWidth[$colSpan][$realColCount] ) )
306 {
307 if ( $wMin > $minWidth[$colSpan][$realColCount] )
308 {
309 $minWidth[$colSpan][$realColCount] = $wMin;
310 }
311 }
312 else
313 {
314 if ( !isset( $minWidth[$colSpan] ) )
315 {
316 $minWidth[$colSpan] = array();
317 }
318 $minWidth[$colSpan][$realColCount] = $wMin;
319 }
320
321 $realColCount += $colSpan;
322
323 if ( $realColCount > $maxRowCount )
324 {
325 $maxRowCount = $realColCount;
326 }
327 }
328 }
329
330 // calculate the start positions of each of the columns
331 // Set pre defined max column width data
332 for ( $columnCount = 0; $columnCount < count( $cols ); $columnCount++ ){
333 if ( isset( $options['cols'][$columnCount] ) && isset($options['cols'][$columnCount]['width']) && $options['cols'][$colName]['width']>0)
334 {
335 $colSpan = 1;
336 if ( isset( $options['cellData'][$realColCount.',0']['size'] ) )
337 {
338 $colSpan = $options['cellData'][$realColCount.',0']['size'];
339 }
340
341 $maxWidth[$colSpan][$columnCount] = $options['cols'][$colName]['width'] - $options['gap'] - 2*$options['cellPadding'];
342 }
343 }
344
345 // Scale column widths
346 $pos=array();
347 $columnWidths = array();
348 $minWidthArray = array();
349 for ( $offset = 0; $offset < count( $cols ); ++$offset )
350 {
351 $columnWidths[$offset] = 0;
352 $minWidthArray[$offset] = 0;
353 }
354 $x=0;
355 $t=$x;
356 $adjustmentWidth=0;
357 $setWidth=0;
358 foreach ( $maxWidth as $span => $tmp1 )
359 {
360 foreach ( $maxWidth[$span] as $offset => $tmp2 )
361 {
362 $currentWidth = 0;
363 $currentMinWidth = 0;
364 for ( $innerCount = 0; $innerCount < $span; $innerCount++ )
365 {
366 $currentWidth += $columnWidths[$offset+$innerCount];
367 $currentMinWidth += $minWidthArray[$offset + $innerCount];
368 }
369 if ( $maxWidth[$span][$offset] > $currentWidth )
370 {
371 if ( $currentWidth == 0 ) // no width set
372 {
373 for ( $i = 0; $i < $span; $i++ )
374 {
375 $columnWidths[$offset + $i] = ceil( $maxWidth[$span][$offset] / $span );
376 $minWidthArray[$offset + $i] = ceil( $minWidth[$span][$offset] / $span );
377 }
378 }
379 else // scale previous set widths
380 {
381 for ( $i = 0; $i < $span; $i++ )
382 {
383 $columnWidths[$offset + $i] = ceil( $maxWidth[$span][$offset] / $currentWidth * $columnWidths[$offset+$i] );
384 $minWidthArray[$offset + $i] = ceil( $minWidth[$span][$offset] / $currentMinWidth * $minWidthArray[$offset+$i] );
385 }
386 }
387 }
388 }
389 }
390
391 $t = 0;
392 foreach ( $columnWidths as $count => $width )
393 {
394 $pos[$count]=$t;
395 // if the column width has been specified then set that here, also total the
396 $t += $width + $options['gap'] + 2*$options['cellPadding'];
397 $adjustmentWidth += $width;
398 $setWidth += $options['gap'] + 2*$options['cellPadding'];
399 $pos[$count+1]=$t;
400 }
401 $pos['_end_'] = $t;
402
403 // if maxWidth is specified, and the table is too wide, and the width has not been set,
404 // then set the width.
405 if ($options['width']==0 && $options['maxWidth'] && $pos['_end_']>$options['maxWidth']){
406 // then need to make this one smaller
407 $options['width']=$options['maxWidth'];
408 }
409
410 // calculate total table width before limiting
411 $totalTableWidth = 0;
412 foreach ( array_keys( $columnWidths ) as $idx ){
413 $totalTableWidth += $columnWidths[$idx];
414 }
415
416 if ( $options['width'] == 0 &&
417 $totalTableWidth > $this->ez['pageWidth'] - $this->leftMargin() - $this->rightMargin() )
418 {
419 $options['width'] = $this->ez['pageWidth'] - $this->leftMargin() - $this->rightMargin();
420 }
421
422 // calculated width as forced. Shrink or enlarge.
423 $newColumnSize = $this->eZCalculateColumnWidth( $columnWidths, $options, $setWidth, $minWidthArray, $adjustmentWidth );
424 if ( $newColumnSize !== false )
425 {
426 $pos = $newColumnSize;
427 $t = $pos['_end_'];
428 }
429
430 /* Calculate max column widths */
431 foreach ( array_keys ( $maxWidth ) as $colspan )
432 {
433 foreach ( array_keys( $maxWidth[$colspan] ) as $offset )
434 {
435 $maxWidth[$colspan][$offset] = 0;
436 for ( $columnCount = $offset; $columnCount < $offset + $colspan; $columnCount ++ )
437 {
438 if ( $maxWidth[$colspan][$offset] == 0 )
439 {
440 $maxWidth[$colspan][$offset] -= ( $options['gap'] + 2*$options['cellPadding'] );
441 }
442 $maxWidth[$colspan][$offset] += ( $pos[$columnCount + 1] - $pos[$columnCount] );
443 }
444 }
445 }
446
447 // now adjust the table to the correct location across the page
448 switch ($options['xPos']){
449 case 'left':
450 $xref = $this->leftMargin();
451 break;
452 case 'right':
453 $xref = $this->ez['pageWidth'] - $this->rightMargin();
454 break;
455 case 'centre':
456 case 'center':
457 $xref = $middle;
458 break;
459 default:
460 $xref = $options['xPos'];
461 break;
462 }
463 switch ($options['xOrientation']){
464 case 'left':
465 case 'right':
466 $dx = $xref;
467 break;
468 case 'centre':
469 case 'center':
470 $dx = $xref-$t/2;
471 break;
472 }
473
474 foreach($pos as $key=>$value){
475 $pos[$key] += $dx + $options['gap']/2;
476 }
477 $x0=$x+$dx + $options['gap']/2;
478 $x1=$t+$dx + $options['gap']/2;
479
480 $baseLeftMargin = $this->leftMargin();
481 $basePos = $pos;
482 $baseX0 = $x0;
483 $baseX1 = $x1;
484
485 // ok, just about ready to make me a table
486 $this->setColor( $options['textCol'] );
487
488 $middle = ($x1+$x0)/2;
489
490 // start a transaction which will be used to regress the table, if there are not enough rows protected
491 if ($options['protectRows']>0){
492 $this->transaction('start');
493 $movedOnce=0;
494 }
495 $abortTable = 1;
496
497 if ( $options['yBottom'] > 0 ) // for aligning table to bottom
498 {
499 $options['test'] = 1;
500 }
501
502 while ($abortTable){
503 $abortTable=0;
504
505 $dm = $this->ez['leftMargin']-$baseLeftMargin;
506 foreach($basePos as $key=>$value){
507 $pos[$key] += $dm;
508 }
509 $x0=$baseX0+$dm;
510 $x1=$baseX1+$dm;
511 $middle = ($x1+$x0)/2;
512
513 // margins may have changed on the newpage
514 $dm = $this->ez['leftMargin']-$baseLeftMargin;
515 foreach($basePos as $key => $value){
516 $pos[$key] += $dm;
517 }
518 $x0=$baseX0+$dm;
519 $x1=$baseX1+$dm;
520
521 $y=$this->y; // to simplify the code a bit
522 $startY = $y;
523
524 // make the table
525 $height = $this->getFontHeight($options['fontSize']);
526 $decender = $this->getFontDecender($options['fontSize']);
527
528 $y0=$y+$decender;
529 $dy=0;
530 if ($options['showHeadings']){
531 // this function will move the start of the table to a new page if it does not fit on this one
532 $headingHeight = $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
533 $y0 = $y+$headingHeight;
534 $y1 = $y;
535
536 $dm = $this->leftMargin()-$baseLeftMargin;
537 foreach($basePos as $k=>$v){
538 $pos[$k]=$v+$dm;
539 }
540 $x0=$baseX0+$dm;
541 $x1=$baseX1+$dm;
542
543 } else {
544 $y1 = $y0;
545 }
546 $firstLine=1;
547
548
549 $isHelperObjectNeeded = ( !$options['test'] && ( $options['shaded'] || isset( $options['titleCellCMYK'] ) ) );
550 // open an object here so that the text can be put in over the shading
551 if ( $isHelperObjectNeeded ){
552 $this->saveState();
553 $textObjectId = $this->openObject();
554 $this->closeObject();
555 $this->addObject($textObjectId);
556 $this->reopenObject($textObjectId);
557 }
558
559 $cnt=0;
560 $newPage=0;
561 $newPageLine = 0;
562 $tableHeaderRow = array();
563 $maxRowCount = count( $data );
564 $oldRowCount = -1;
565
566 $leftOvers=array();
567
568 for ( $rowCount = 0; $rowCount < $maxRowCount; ++$rowCount )
569 {
570 if ( $oldRowCount != -1)
571 {
572 $rowCount = $oldRowCount;
573 $oldRowCount = -1;
574 }
575
576 $row = $data[$rowCount];
577
578 $cnt++;
579 // the transaction support will be used to prevent rows being split
580 if ($options['splitRows']==0){
581 $pageStart = $this->ezPageCount;
582 if (isset($this->ez['columns']) && $this->ez['columns']['on']==1){
583 $columnStart = $this->ez['columns']['colNum'];
584 }
585 if ( !$options['test'] )
586 {
587 $this->transaction('start');
588 }
589 $row_orig = $data[$rowCount];
590 $y_orig = $y;
591 $y0_orig = $y0;
592 $y1_orig = $y1;
593 }
594 $ok=0;
595 $secondTurn=0;
596 while(!$abortTable && $ok == 0){
597
598 $maxRowHeight=0;
599 $newRow=1;
600 while(!$abortTable && ($newPage || $newRow)){
601
602 $resetLeftOvers = true;
603 if ( count( $leftOvers ) > 0 )
604 $row = $leftOvers;
605
606 if ($newPage || $y<$this->ez['bottomMargin'] || (isset($options['minRowSpace']) && $y<($this->ez['bottomMargin']+$options['minRowSpace'])) ){
607 // check that enough rows are with the heading
608 if ($options['protectRows']>0 && $movedOnce==0 && $cnt<=$options['protectRows']){
609 // then we need to move the whole table onto the next page
610 $movedOnce = 1;
611 $abortTable = 1;
612 }
613
614 $y2=$y-$maxRowHeight+2*$height+$decender-$newRow*$height;
615 if ($options['showLines']){
616 if (!$options['showHeadings']){
617 $y0=$y1;
618 }
619 }
620 if ( $isHelperObjectNeeded )
621 {
622 $this->closeObject();
623 $this->restoreState();
624 }
625 $this->ezNewPage();
626 // and the margins may have changed, this is due to the possibility of the columns being turned on
627 // as the columns are managed by manipulating the margins
628
629 $dm = $this->leftMargin()-$baseLeftMargin;
630 foreach($basePos as $k=>$v){
631 $pos[$k]=$v+$dm;
632 }
633
634 $x0=$baseX0+$dm;
635 $x1=$baseX1+$dm;
636
637 if ( $isHelperObjectNeeded )
638 {
639 $this->saveState();
640 $textObjectId = $this->openObject();
641 $this->closeObject();
642 $this->addObject($textObjectId);
643 $this->reopenObject($textObjectId);
644 }
645 $this->setColor( $options['textCol'], 1 );
646 $y = $this->ez['pageHeight']-$this->ez['topMargin'];
647 $y0=$y+$decender;
648 $maxRowHeight=0;
649 if ($options['showHeadings']){
650 $this->ezPrvtTableColumnHeadings($cols,$pos,$maxWidth,$height,$decender,$options['rowGap'],$options['fontSize'],$y,$options);
651 $y1=$y;
652 } else {
653 $y1=$y0;
654 }
655 $firstLine=1;
656 $y -= $height;
657
658 if ( $options['repeatTableHeader'] && $oldRowCount == -1)
659 {
660 $oldRowCount = $rowCount;
661 $rowCount = 0;
662 $row = $data[$rowCount];
663 $resetLeftOvers = false;
664 }
665 }
666
667 $newRow=0;
668 // write the actual data
669 // if these cells need to be split over a page, then $newPage will be set, and the remaining
670 // text will be placed in $leftOvers
671 $newPage=0;
672 if ( $resetLeftOvers )
673 $leftOvers=array();
674
675 $realColumnCount = 0;
676
677 $bgTitleX = 2147483647;
678 $bgTitleY = -2147483647;
679 $bgTitleW = 0;
680 $bgTitleH = 0;
681
682 for ( $columnCount = 0; $columnCount < count ( $row ); $columnCount++ )
683 {
684 // Get colSpan
685 if ( isset( $options['cellData'][$realColumnCount.','.$rowCount]['size'] ) )
686 {
687 $colSpan = $options['cellData'][$realColumnCount.','.$rowCount]['size'];
688 }
689 else
690 {
691 $colSpan = 1;
692 }
693
694 $this->ezSetY($y+$height);
695 $colNewPage=0;
696
697 $row[$columnCount] = $this->fixWhitespace( $row[$columnCount] );
698 $lines = explode("\n",$row[$columnCount]);
699 $this->y -= $options['rowGap'] + $options['cellPadding'];
700 $this->setXOffset( $pos[$realColumnCount] );
701 $leftMargin = $this->ez['leftMargin'];
702 $this->ez['leftMargin'] = $pos[$realColumnCount];
703
704 foreach ($lines as $line)
705 {
706 $line = $this->ezProcessText($line);
707 $start=1;
708
709 while (strlen($line) || $start){
710 $start=0;
711 if (!$colNewPage){
712 $this->y-=$height;
713 }
714 if ($this->y < $this->ez['bottomMargin']){
715 $newPage=1;
716 $newPageLine = 1;
717 $colNewPage=1;
718 }
719 if ($colNewPage){
720 if (isset($leftOvers[$realColumnCount])){
721 $leftOvers[$realColumnCount].="\n".$line;
722 } else {
723 $leftOvers[$realColumnCount] = $line;
724 }
725 $line='';
726 } else {
727 if (isset($options['cols'][$realColumnCount]) && isset($options['cols'][$realColumnCount]['justification']) ){
728 $just = $options['cols'][$realColumnCount]['justification'];
729 } else {
730 $just='left';
731 }
732 $storeY = $this->y;
733 if ( isset( $options['cellData'][$realColumnCount.','.$rowCount] ) &&
734 $options['cellData'][$realColumnCount.','.$rowCount]['title'] === true )
735 {
736 $this->setColor( $options['titleTextCMYK'] );
737 $fontSize = $options['titleFontSize'];
738 }
739 else
740 {
741 $this->setColor( $options['textCol'], 1 );
742 $fontSize = $options['fontSize'];
743 }
744
745 $textInfo = $this->addTextWrap( $pos[$realColumnCount],
746 $this->y,
747 $maxWidth[$colSpan][$realColumnCount],
748 $fontSize,
749 $line,
750 $just,
751 0,
752 $options['test'] );
753
754 $this->y = $storeY;
755 if ( isset( $textInfo['text'] ) )
756 $line = $textInfo['text'];
757 else
758 $line = '';
759
760 if ( $line == '' )
761 {
762 if ( isset( $textInfo['height'] ) )
763 $this->y -= $textInfo['height'];
764 }
765 }
766 }
767 }
768 $this->ez['leftMargin'] = $leftMargin;
769
770 $dy=$y-$this->y+$options['rowGap']+$options['cellPadding'];
771 if ($dy>$maxRowHeight)
772 {
773 $maxRowHeight=$dy;
774 }
775
777 // calc title's background rect
779 if ( isset( $options['cellData'][$realColumnCount.','.$rowCount] ) &&
780 $options['cellData'][$realColumnCount.','.$rowCount]['title'] === true &&
781 isset( $options['titleCellCMYK'] ) )
782 {
783 $cellX = $pos[$realColumnCount] - $options['gap']/2;
784 $cellY = $y+$decender+$height;
785 $cellW = $maxWidth[$colSpan][$realColumnCount] + $options['gap'];
786 $cellH = -$maxRowHeight;
787
788 if ( $bgTitleX > $cellX )
789 $bgTitleX = $cellX;
790
791 if ( $bgTitleY < $cellY )
792 $bgTitleY = $cellY;
793
794 $bgTitleW += $cellW;
795
796 if ( $bgTitleH > $cellH )
797 $bgTitleH = $cellH;
798 }
800
801 $realColumnCount += $colSpan;
802
803 } // End for ( ... count( $row ) ... )
804
805 if ( !$options['test'] )
806 {
808 // draw title's background
810 if( $bgTitleW != 0 && $bgTitleH != 0 )
811 {
812 // we have non-empty rect
813 $this->closeObject();
814 $this->setColor( $options['titleCellCMYK'], true );
815 $this->filledRectangle( $bgTitleX, $bgTitleY, $bgTitleW, $bgTitleH );
816 $this->reopenObject($textObjectId);
817 }
819
820 if ( isset( $options['cellData'][$realColumnCount.','.$rowCount] ) &&
821 $options['cellData'][$realColumnCount.','.$rowCount]['title'] === true )
822 {
823 $shadeCol = $options['titleCellCMYK'];
824 }
825 else
826 {
827 if( $cnt % 2 == 0 )
828 {
829 $shadeCol = $options['shadeCol'];
830 }
831 else
832 {
833 $shadeCol = $options['shadeCol2'];
834 }
835 }
836
837 $rowHeight = $maxRowHeight;
838 $realColumnCount = 0;
839 for ( $columnCount = 0; $realColumnCount < $maxRowCount; $columnCount++ )
840 {
841 if ( isset( $options['cellData'][$realColumnCount.','.$rowCount]['size'] ) )
842 {
843 $colSpan = $options['cellData'][$realColumnCount.','.$rowCount]['size'];
844 }
845 else
846 {
847 $colSpan = 1;
848 }
849
850 if ( $options['shaded'] && $cnt % 2 == 0 )
851 {
852 $this->closeObject();
853 $this->setColor( $shadeCol );
854 $this->filledRectangle($pos[$realColumnCount] - $options['cellPadding'],
855 $y,
856 $maxWidth[$colSpan][$realColumnCount] + 2*$options['cellPadding'],
857 -$rowHeight );
858 $this->reopenObject($textObjectId);
859 }
860
861 if ($options['shaded']==2 && $cnt%2==1){
862 $this->closeObject();
863 $this->setColor( $shadeCol );
864 $this->filledRectangle($pos[$realColumnCount] - $options['cellPadding'],
865 $y,
866 $maxWidth[$colSpan][$realColumnCount] + 2*$options['cellPadding'],
867 -$rowHeight );
868 $this->reopenObject($textObjectId);
869 }
870
871 $realColumnCount += $colSpan;
872 }
873
874 // now add the shading underneath
875 // Draw lines for each row and above
876 if ( $options['showLines'] > 0 )
877 {
878 $this->saveState();
879 $this->setStrokeColorRGB($options['lineCol'][0],$options['lineCol'][1],$options['lineCol'][2],1);
880
881 if ( $rowCount == 0 || $newPageLine == 1 )
882 {
883 $this->line( $x0-$options['gap']/2, $y+$decender+$height, $x1-$options['gap']/2, $y+$decender+$height );
884 }
885 $this->line( $x0-$options['gap']/2, $y+$decender+$height, $x0-$options['gap']/2, $y+$decender+$height-$maxRowHeight );
886 $this->line( $x1-$options['gap']/2, $y+$decender+$height, $x1-$options['gap']/2, $y+$decender+$height-$maxRowHeight );
887
888 if ( $options['showLines'] > 1 )
889 {
890 // draw inner lines
891 $this->line( $x0-$options['gap']/2, $y+$decender+$height-$maxRowHeight, $x1-$options['gap']/2, $y+$decender+$height-$maxRowHeight );
892
893 for ( $posOffset = 0; $posOffset < count( $pos ) - 2; )
894 {
895 $colSpan = 1;
896 if ( isset( $options['cellData'][$posOffset.','.$rowCount]['size'] ) )
897 {
898 $colSpan = $options['cellData'][$posOffset.','.$rowCount]['size'];
899 }
900 $this->line( $pos[$posOffset+$colSpan]-$options['gap']/2, $y+$decender+$height,
901 $pos[$posOffset+$colSpan]-$options['gap']/2, $y+$decender+$height-$maxRowHeight );
902 $posOffset += $colSpan;
903 }
904 }
905 else if ( $rowCount == count( $data ) - 1 )
906 {
907 $this->line( $x0-$options['gap']/2, $y+$decender+$height-$maxRowHeight, $x1-$options['gap']/2, $y+$decender+$height-$maxRowHeight );
908 }
909 $this->restoreState();
910 }
911 if ($options['showLines']>1){
912 $this->saveState();
913 $this->setStrokeColorRGB($options['lineCol'][0],$options['lineCol'][1],$options['lineCol'][2],1);
914
915 if ($firstLine){
916 $this->setLineStyle($options['outerLineThickness']);
917 $firstLine=0;
918 } else {
919 $this->setLineStyle($options['innerLineThickness']);
920 }
921 $this->line($x0-$options['gap']/2,$y+$decender+$height-$maxRowHeight,$x1-$options['gap']/2,$y+$decender+$height-$maxRowHeight);
922 $this->restoreState();
923 }
924 }
925 } // end of while
926 $y=$y-$maxRowHeight;
927
928 // checking row split over pages
929 if ( $options['splitRows'] == 0 )
930 {
931 if ( ( ($this->ezPageCount != $pageStart) || (isset($this->ez['columns']) && $this->ez['columns']['on']==1 && $columnStart != $this->ez['columns']['colNum'] )) && $secondTurn==0){
932 // then we need to go back and try that again !
933 $newPage=1;
934 $newPageLine = 1;
935 $secondTurn=1;
936 $this->transaction('rewind');
937 $row = $row_orig;
938 $y = $y_orig;
939 $y0 = $y0_orig;
940 $y1 = $y1_orig;
941 $ok=0;
942
943 $dm = $this->leftMargin()-$baseLeftMargin;
944 foreach($basePos as $k=>$v){
945 $pos[$k]=$v+$dm;
946 }
947 $x0=$baseX0+$dm;
948 $x1=$baseX1+$dm;
949
950 } else {
951 $this->transaction('commit');
952 $ok=1;
953 }
954 }
955 else
956 {
957 $ok=1; // don't go round the loop if splitting rows is allowed
958 }
959
960 } // end of while to check for row splitting
961 if ($abortTable){
962 if ($ok==0){
963 $this->transaction('abort');
964 }
965 // only the outer transaction should be operational
966 $this->transaction('rewind');
967 $this->ezNewPage();
968 break;
969 }
970
971 } // end of ( ... $rowCount < $maxRowCount ... )
972
973 if ( isset ( $options['yBottom'] ) && $options['yBottom'] > 0 )
974 {
975 $tableHeight = $startY - $y;
976 $this->y = $options['yBottom'] + $tableHeight;
977 $yBottom = $options['yBottom'];
978 unset( $options['yBottom'] );
979 $options['test'] = 0;
980 $this->transaction('rewind');
981 // $this->transaction('start');
982 $abortTable = 1;
983 continue;
984 }
985
986 } // end of while ($abortTable)
987
988 // table has been put on the page, the rows guarded as required, commit.
989 $this->transaction('commit');
990
991 $y2=$y+$decender;
992 if ($options['showLines']){
993 if (!$options['showHeadings']){
994 $y0=$y1;
995 }
996 // $this->ezPrvtTableDrawLines($pos,$options['gap'],$x0,$x1,$y0,$y1,$y2,$options['lineCol'],$options['innerLineThickness'],$options['outerLineThickness'],$options['showLines']);
997 }
998
999 // close the object for drawing the text on top
1000 if ( $isHelperObjectNeeded ){
1001 $this->closeObject();
1002 $this->restoreState();
1003 }
1004
1005 if ( $options['overwrite'] > 0 )
1006 {
1007 $this->y=$tableStartY;
1008 }
1009 else
1010 {
1011 $this->y=$y;
1012 }
1013
1014 return $this->y;
1015 }
1016
1029 function eZCalculateColumnWidth( $columnWidthArray,
1030 $options,
1031 $marginWidth,
1032 $minWidthArray,
1033 $totalWidth,
1034 $fixedSizeArray = array() )
1035 {
1036 $newWidth = 0;
1037 if ( $options['width'] && $totalWidth>0 ){
1038 $newCleanWidth = $options['width'] - $marginWidth;
1039 $t = 0;
1040 $pos = array();
1041 foreach ( $columnWidthArray as $count => $width )
1042 {
1043 $pos[$count] = $t;
1044
1045 if ( isset( $fixedSizeArray[(string)$count] ) )
1046 {
1047 $t += $fixedSizeArray[(string)$count] + $options['gap'] + 2*$options['cellPadding'];
1048 continue;
1049 }
1050
1051 $newWidth = round( $newCleanWidth/$totalWidth * $columnWidthArray[$count] );
1052
1053 if ( $newWidth < $minWidthArray[$count] &&
1054 count( $fixedSizeArray ) < count( $columnWidthArray ) )
1055 {
1056 $fixedSizeArray[(string)$count] = $minWidthArray[$count];
1057
1058 return $this->eZCalculateColumnWidth( $columnWidthArray,
1059 $options,
1060 $marginWidth + $minWidthArray[$count],
1061 $minWidthArray,
1062 $totalWidth - $minWidthArray[$count],
1063 $fixedSizeArray );
1064 }
1065 $t += $newWidth + $options['gap'] + 2*$options['cellPadding'];
1066 }
1067 $pos[]=$t;
1068 $pos['_end_']=$t;
1069 return $pos;
1070 }
1071
1072 return false;
1073 }
1074
1075 function ezPrvtTableDrawLines($pos,$gap,$x0,$x1,$y0,$y1,$y2,$col,$inner,$outer,$opt=1){
1076 $x0=1000;
1077 $x1=0;
1078 $this->setStrokeColorRGB($col[0],$col[1],$col[2]);
1079 $cnt=0;
1080 $n = count($pos);
1081 foreach($pos as $x){
1082 $cnt++;
1083 if ($cnt==1 || $cnt==$n){
1084 $this->setLineStyle($outer);
1085 } else {
1086 $this->setLineStyle($inner);
1087 }
1088 $this->line($x-$gap/2,$y0,$x-$gap/2,$y2);
1089 if ($x>$x1){ $x1=$x; };
1090 if ($x<$x0){ $x0=$x; };
1091 }
1092 $this->setLineStyle($outer);
1093 $this->line($x0-$gap/2-$outer/2,$y0,$x1-$gap/2+$outer/2,$y0);
1094 // only do the second line if it is different to the first, AND each row does not have
1095 // a line on it.
1096 if ($y0!=$y1 && $opt<2){
1097 $this->line($x0-$gap/2,$y1,$x1-$gap/2,$y1);
1098 }
1099 $this->line($x0-$gap/2-$outer/2,$y2,$x1-$gap/2+$outer/2,$y2);
1100 }
1101
1105 function callAnchor( $info )
1106 {
1107 $paramArray = explode( ':', $info['p'] );
1108
1109 $this->addDestination( $paramArray[0], $paramArray[1], $this->yOffset() + $this->getFontHeight( $this->fontSize ) );
1110 }
1111
1115 function callHeader( $params )
1116 {
1117 $options = array();
1118
1119 if ( isset( $params['size'] ) )
1120 {
1121 $options['fontSize'] = $params['size'];
1122 }
1123
1124 if ( isset( $params['justification'] ) )
1125 {
1126 $options['justification'] = $params['justification'];
1127 }
1128
1129 if ( isset( $params['fontName'] ) )
1130 {
1131 $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['fontName'];
1132 }
1133
1134 $this->addToPreStack( $options );
1135
1136 $label = $params['label'];
1137 $level = $params['level'];
1138
1139 return '<C:callInsertTOC:'. $label .','. $level .'>';
1140 }
1141
1145 function callImage( $info )
1146 {
1147 $params = array();
1148 $leftMargin = false;
1149 $rightMargin = false;
1150
1151 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1152
1153 $filename = rawurldecode( $params['src'] );
1154
1155 $mimetype = eZMimeType::findByFileContents( $filename );
1156
1157 $this->transaction( 'start' );
1158
1159 if ( !isset( $params['static'] ) )
1160 {
1161 $params['static'] = false;
1162 }
1163
1164 if ( $this->yOffset()-$params['height'] < $this->ez['bottomMargin'] )
1165 {
1166 $this->ezNewPage();
1167 }
1168
1169 if ( isset( $params['dpi'] ) )
1170 {
1171 $newWidth = (int)( $params['width'] * ( (int)$params['dpi'] / 72 ) );
1172 $newHeight = (int)( $params['height'] * ( (int)$params['dpi'] / 72 ) );
1173 $newFilename = eZSys::cacheDirectory() . '/' . md5( mt_rand() ) . '.jpg';
1174 while( file_exists( $newFilename ) )
1175 {
1176 $newFilename = eZSys::cacheDirectory() . '/' . md5( mt_rand() ) . '.jpg';
1177 }
1178
1179 $img = eZImageManager::factory();
1180 $newImg = $img->convert( $filename,
1181 $newFilename,
1182 false,
1183 array( 'filters' => array( array( 'name' => 'geometry/scaledownonly',
1184 'data' => array( $newWidth, $newHeight ) ) ) ) );
1185 $filename = $newFilename['url'];
1186 }
1187
1188 $drawableAreaWidth = $this->ez['pageWidth'] - $this->ez['leftMargin'] - $this->ez['rightMargin'];
1189
1190 switch( $params['align'] )
1191 {
1192 case 'right':
1193 {
1194 $xOffset = $this->ez['pageWidth'] - ( $this->rightMargin() + $params['width'] );
1195 $rightMargin = $this->rightMargin() + $params['width'];
1196 if ( $rightMargin > ( $drawableAreaWidth + $this->rightMargin() ) )
1197 {
1198 // the image is equal or larger then width of the page(of the drawable area) => no point
1199 // to set $rightMargin and next object(text, image, ...) should be outputted below the image.
1200 $rightMargin = false;
1201 }
1202 } break;
1203
1204 case 'center':
1205 {
1206 $xOffset = ( $this->ez['pageWidth'] - $this->rightMargin() - $this->leftMargin() ) / 2 + $this->leftMargin() - $params['width'] / 2;
1207 } break;
1208
1209 case 'left':
1210 default:
1211 {
1212 $xOffset = $this->leftMargin();
1213 $leftMargin = $this->leftMargin() + $params['width'];
1214 if ( $leftMargin > ( $drawableAreaWidth + $this->leftMargin() ) )
1215 {
1216 // the image is equal or larger then width of the page(of the drawable area) => no point
1217 // to set $leftMargin and next object(text, image, ...) should be outputted below the image.
1218 $leftMargin = false;
1219 }
1220
1221 } break;
1222 }
1223
1224 if ( isset( $params['x'] ) )
1225 {
1226 $xOffset = $params['x'];
1227 $leftMargin = false;
1228 $rightMargin = false;
1229 }
1230
1231 $yOffset = $this->yOffset();
1232 $whileCount = 0;
1233
1234 if ( $params['width'] < $drawableAreaWidth )
1235 {
1236 while ( $this->leftMargin( $yOffset ) > $xOffset &&
1237 ++$whileCount < 100 )
1238 {
1239 $yOffset -= 10;
1240 }
1241 }
1242
1243 $yOffset -= $params['height'];
1244 $yOffset += $this->lineHeight()/2;
1245 if ( isset( $params['y'] ) )
1246 {
1247 $yOffset = $params['y'];
1248 }
1249
1250 if ( $leftMargin !== false )
1251 {
1252 $this->setLimitedLeftMargin( $yOffset - 7, $yOffset + $params['height'] + 7, $leftMargin + 7 );
1253 }
1254 if ( $rightMargin !== false )
1255 {
1256 $this->setLimitedRightMargin( $yOffset- 7, $yOffset + $params['height'] + 7, $rightMargin + 7 );
1257 }
1258
1259 switch( $mimetype['name'] )
1260 {
1261 case 'image/gif':
1262 {
1263 $newFilename = eZSys::cacheDirectory() . '/' . md5( mt_rand() ) . '.jpg';
1264 while( file_exists( $newFilename ) )
1265 {
1266 $newFilename = eZSys::cacheDirectory() . '/' . md5( mt_rand() ) . '.jpg';
1267 }
1268 $newMimetype = eZMimeType::findByURL( $newFilename );
1269
1270 $img = eZImageManager::factory();
1271 $newImg = $img->convert( $mimetype,
1272 $newMimetype,
1273 false,
1274 array() );
1275 $this->addJpegFromFile( $newMimetype['url'],
1276 $xOffset,
1277 $yOffset,
1278 $params['width'],
1279 $params['height'] );
1280 } break;
1281
1282 case 'image/jpeg':
1283 {
1284 $this->addJpegFromFile( $filename,
1285 $xOffset,
1286 $yOffset,
1287 $params['width'],
1288 $params['height'] );
1289 } break;
1290
1291 case 'image/png':
1292 {
1293 if ( $this->addPngFromFile( $filename,
1294 $xOffset,
1295 $yOffset,
1296 $params['width'],
1297 $params['height'] ) === false )
1298 {
1299 $this->transaction('abort');
1300 return;
1301 }
1302 } break;
1303
1304 default:
1305 {
1306 eZDebug::writeError( 'Unsupported image file type, '. $mimetype['name'], __METHOD__ );
1307 $this->transaction( 'abort' );
1308 return;
1309 } break;
1310 }
1311
1312 $this->transaction( 'commit' );
1313
1314 if ( !$leftMargin && !$rightMargin && !$params['static'] )
1315 {
1316 $this->y -= $params['height'] + $this->lineHeight();
1317 }
1318
1319 return array( 'y' => $params['height'] + $this->lineHeight() );
1320 }
1321
1322
1326 function callKeyword( $info )
1327 {
1328 $keyWord = $this->fixWhitespace( rawurldecode( $info['p'] ) );
1329 $page = $this->ezWhatPageNumber($this->ezGetCurrentPageNumber());
1330
1331 if ( !isset( $this->KeywordArray[$keyWord] ) )
1332 {
1333 $this->KeywordArray[$keyWord] = array();
1334 }
1335
1336 if ( !isset( $this->KeywordArray[$keyWord][(string)$page] ) )
1337 {
1338 $label = $info['p'] .':'. $page;
1339 $this->KeywordArray[$keyWord][(string)$page] = array( 'label' => $label );
1340
1341 $this->addDestination( 'keyword:'.$label,
1342 'FitH',
1343 $this->yOffset() );
1344 }
1345 }
1346
1350 function callInsertTOC( $info )
1351 {
1352 $params = explode( ',', $info['p'] );
1353
1354 $label = $params[0];
1355 $level = $params[1];
1356
1357 $tocCount = count( $this->TOC );
1358 $this->TOC[] = array( 'label' => $this->fixWhitespace( rawurldecode( $label ) ),
1359 'localPageNumber' => $this->ezWhatPageNumber( $this->ezGetCurrentPageNumber() ),
1360 'level' => $level,
1361 'pageNumber' => $this->ezGetCurrentPageNumber() );
1362 $this->addDestination( 'toc'. $tocCount,
1363 'FitH',
1364 $this->yOffset() + $this->getFontHeight( $this->fontSize() ) );
1365 }
1366
1370 function callTOC( $info )
1371 {
1372 $params = array();
1373
1374 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1375
1376 $sizes = isset( $params['size'] ) ? explode( ',', $params['size'] ) : '';
1377 $indents = isset( $params['indent'] ) ? explode( ',', $params['indent'] ) : '';
1378 $dots = isset( $params['dots'] ) ? $params['dots'] : '';
1379 $contentText = isset( $params['contentText'] ) ? $params['contentText'] : ezpI18n::tr( 'lib/ezpdf/classes', 'Contents', 'Table of contents' );
1380
1381 $this->insertTOC( $sizes, $indents, $dots, $contentText );
1382 }
1383
1387 function callNewPage( $info )
1388 {
1389 $this->ezNewPage();
1390 }
1391
1392 function callIndex( $info )
1393 {
1394 $this->ezNewPage();
1395 $fontSize = $this->fontSize();
1396 Cezpdf::ezText( ezpI18n::tr( 'lib/ezpdf/classes', 'Index', 'Keyword index name' ) . '<C:callInsertTOC:Index,1>'."\n", 26, array('justification'=>'centre'));
1397
1398 if ( count( $this->KeywordArray ) == 0 )
1399 return;
1400
1401 ksort( $this->KeywordArray );
1402 reset( $this->KeywordArray );
1403
1404 $this->ezColumnsStart( array( 'num' => 2 ) );
1405
1406 foreach( array_keys( $this->KeywordArray ) as $keyWord )
1407 {
1408 Cezpdf::ezText( $keyWord,
1409 $fontSize,
1410 array( 'justification' => 'left' ) );
1411
1412 foreach( array_keys( $this->KeywordArray[$keyWord] ) as $page )
1413 {
1414 Cezpdf::ezText( '<c:ilink:keyword:'. $this->KeywordArray[$keyWord][$page]['label'] .'> '. $page .'</c:ilink>',
1415 $fontSize,
1416 array( 'justification' => 'right' ) );
1417 }
1418 }
1419
1420 $this->ezColumnsStop();
1421 $this->setFontSize( $fontSize );
1422 }
1423
1433 function insertTOC( $sizeArray = array( 20, 18, 16, 14, 12 ),
1434 $indentArray = array( 0, 4, 6, 8, 10 ),
1435 $dots = true,
1436 $contentText = '',
1437 $level = 3 )
1438 {
1439 $fontSize = $this->fontSize();
1440 $this->ezStopPageNumbers(1,1);
1441
1442 $this->ezInsertMode(1,1,'before');
1443 $this->ezNewPage();
1444 Cezpdf::ezText( $contentText ."\n", 26, array('justification'=>'centre'));
1445
1446 foreach($this->TOC as $k=>$v){
1447 if ( $v['level'] <= $level )
1448 {
1449 if ( $dots )
1450 {
1451 Cezpdf::ezText( '<c:ilink:toc'. $k .'>'. $v['label'] .'</c:ilink>',
1452 $sizeArray[$v['level']-1],
1453 array( 'left' => $indentArray[$v['level']-1],
1454 'right' => 100 ) );
1455 Cezpdf::ezText( '<C:dots:'. $sizeArray[$v['level']-1].$v['localPageNumber'] .'>',
1456 $sizeArray[$v['level']-1] );
1457 Cezpdf::ezText( "\n", $sizeArray[$v['level']-1] );
1458 }
1459 else
1460 {
1461 Cezpdf::ezText( '<c:ilink:toc'. $k .'>'.$v['label'].'</c:ilink>',
1462 $sizeArray[$v['level']-1],
1463 array( 'left' => $indentArray[$v['level']-1] ) );
1464 Cezpdf::ezText( '<c:ilink:toc'. $k .'>'. $v['localPageNumber'] .'</c:ilink>',
1465 $sizeArray[$v['level']-1],
1466 array( 'justification' => 'right' ) );
1467 }
1468 }
1469 }
1470
1471 $this->setFontSize( $fontSize );
1472 $this->ezInsertMode(0);
1473 }
1474
1475 function dots($info)
1476 {
1477 // draw a dotted line over to the right and put on a page number
1478 $tmp = $info['p'];
1479 $size = substr($tmp, 0, 2);
1480 $thick=1;
1481 $lbl = substr($tmp,2);
1482 $xpos = $this->ez['pageWidth'] - $this->rightMargin() - $this->leftMargin();
1483
1484 $this->saveState();
1485 $this->setLineStyle($thick,'round','',array(0,10));
1486 $this->line($xpos,$info['y'],$info['x']+5,$info['y']);
1487 $this->restoreState();
1488 $this->addText($xpos+5,$info['y'],$size,$lbl);
1489 $this->setXOffset( $xpos+5+$this->getTextWidth($lbl, $size) );
1490 }
1491
1495 function callFont( $params )
1496 {
1497 $options = array();
1498
1499 $keyArray = array ( 'c', 'm', 'y', 'k' );
1500 if ( isset( $params['cmyk'] ) )
1501 {
1502 $params['cmyk'] = explode( ',', $params['cmyk'] );
1503 foreach ( array_keys( $params['cmyk'] ) as $key )
1504 {
1505 $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key];
1506 }
1507 $this->setStrokeColor( $params['cmyk'] );
1508 }
1509
1510 if ( isset( $params['name'] ) )
1511 {
1512 $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['name'];
1513 }
1514
1515 if ( isset( $params['size'] ) )
1516 {
1517 $options['fontSize'] = $params['size'];
1518 }
1519
1520 if ( isset( $params['justification'] ) )
1521 {
1522 $options['justification'] = $params['justification'];
1523 }
1524
1525 $this->addToPreStack( $options );
1526
1527 return '';
1528 }
1529
1530 function fixWhitespace( &$text )
1531 {
1532 $text = str_replace( array( self::SPACE,
1533 self::TAB,
1534 self::NEWLINE ),
1535 array( ' ',
1536 "\t",
1537 "\n" ),
1538 $text );
1539 return $text;
1540 }
1541
1545 function ezText( $text, $size=0, $options=array(), $test=0)
1546 {
1547 $text = eZPDFTable::fixWhitespace( $text );
1548
1549 $textLen = strlen( $text );
1550 $newText = '';
1551 for ( $offSet = 0; $offSet < $textLen; $offSet++ )
1552 {
1553 if ( $text[$offSet] == '<' )
1554 {
1555 if ( strcmp( substr($text, $offSet+1, strlen( 'ezCall' ) ), 'ezCall' ) == 0 ) // ez library preprocessing call.
1556 {
1557 $newTextLength = strlen( $newText );
1558 if ( $newTextLength > 0 && $newText[$newTextLength - 1] == "\n" )
1559 {
1560 $newText = rtrim( $newText, "\n" );
1561 $this->addDocSpecification( $newText );
1562 $newText = "\n";
1563 }
1564 else
1565 {
1566 $this->addDocSpecification( $newText );
1567 $newText = '';
1568 }
1569
1570 $params = array();
1571 $funcName = '';
1572
1573 $offSet = eZPDFTable::extractFunction( $text, $offSet, $funcName, $params, 'ezCall' );
1574
1575 $newText .= $this->$funcName( $params );
1576
1577 continue;
1578 }
1579 else if ( strcmp( substr($text, $offSet+1, strlen( '/ezCall' ) ), '/ezCall' ) == 0 )
1580 {
1581 $this->addDocSpecification( $newText );
1582 array_pop( $this->PreStack );
1583 $offSet = strpos( $text, '>', $offSet );
1584 $newText = '';
1585 continue;
1586 }
1587 else if ( strcmp( substr($text, $offSet+1, strlen( 'ezGroup' ) ), 'ezGroup' ) == 0 ) // special call for processing whole text group, used by extends table.
1588 {
1589 $newTextLength = strlen( $newText );
1590 if ( $newTextLength > 0 && $newText[$newTextLength - 1] == "\n" )
1591 {
1592 $newText = rtrim( $newText, "\n" );
1593 $this->addDocSpecification( $newText );
1594 $newText = "\n";
1595 }
1596 else
1597 {
1598 $this->addDocSpecification( $newText );
1599 $newText = '';
1600 }
1601
1602 $params = array();
1603 $funcName = '';
1604
1605 $offSet = eZPDFTable::extractFunction( $text, $offSet, $funcName, $params, 'ezGroup' );
1606 $offSet++;
1607 $endGroup = strpos( $text, '</ezGroup:', $offSet );
1608 $groupText = substr( $text, $offSet, $endGroup - $offSet );
1609 $groupText = urldecode( $groupText );
1610
1611 $this->$funcName( $params, $groupText );
1612
1613 $offSet = strpos( $text, '>', $endGroup );
1614 continue;
1615 }
1616 }
1617 $newText .= $text[$offSet];
1618 }
1619 if ( strlen( $newText ) > 0 )
1620 {
1621 $this->addDocSpecification( $newText );
1622 }
1623
1624 $this->outputDocSpecification();
1625 }
1626
1635 function fixupTableCellText( $text )
1636 {
1637 $text = preg_replace( "/^" . self::NEWLINE . "/i", "", $text );
1638 $text = preg_replace( "/" . self::NEWLINE . "$/i", "", $text );
1639 return preg_replace( "'<[\/]*?ezCall:[^<>]*?>'si", "", $text );
1640 }
1641
1647 function callRectangle( $info )
1648 {
1649 $params = array();
1650
1651 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1652
1653 $keyArray = array ( 'c', 'm', 'y', 'k' );
1654 $cmykColor = explode( ',', $params['cmyk'] );
1655
1656 foreach ( array_keys( $cmykColor ) as $key )
1657 {
1658 $cmykColor[$keyArray[$key]] = $cmykColor[$key];
1659 unset( $cmykColor[$key] );
1660 }
1661
1662 $stackColor = $this->currentStrokeColour;
1663 $this->setStrokeColor( $cmykColor );
1664
1665 if ( isset( $params['x'] ) )
1666 {
1667 $x1 = $params['x'];
1668 $x2 = $x1 + $params['width'];
1669 }
1670 if ( isset( $params['y'] ) )
1671 {
1672 $y1 = $params['y'];
1673 $y2 = $y1 + $params['height'];
1674 }
1675
1676 if ( isset( $params['topY'] ) )
1677 {
1678 $y2 = $params['topY'];
1679 if ( $params['height'] > 0 )
1680 {
1681 $y1 = $params['topY'] - $params['height'];
1682 }
1683 else
1684 {
1685 $y1 = $this->yOffset() + $params['height'];
1686 }
1687 }
1688
1689 $this->setLineStyle( $params['line_width'] );
1690
1691 if ( $params['corner'] )
1692 {
1693 $factor = $params['corner'];
1694 $degree = 0;
1695
1696 $this->line( $x1 + $factor, $y1, $x2 - $factor, $y1 );
1697 $this->line( $x2, $y1 + $factor, $x2, $y2 - $factor );
1698 $this->line( $x2 - $factor, $y2, $x1 + $factor, $y2 );
1699 $this->line( $x1, $y2 - $factor, $x1, $y1 + $factor );
1700
1701 $this->curve( $x2 - $factor, $y1,
1702 $x2, $y1 - $degree * $factor,
1703 $x2 + $degree * $factor, $y1,
1704 $x2, $y1 + $factor );
1705 $this->curve( $x2, $y2 - $factor,
1706 $x2 + $degree * $factor, $y2,
1707 $x2, $y2 + $degree * $factor,
1708 $x2 - $factor, $y2 );
1709 $this->curve( $x1 + $factor, $y2,
1710 $x1, $y2 + $degree * $factor,
1711 $x1 - $degree * $factor, $y2,
1712 $x1, $y2 - $factor );
1713 $this->curve( $x1, $y1 + $factor,
1714 $x1 - $degree * $factor, $y1,
1715 $x1, $y1 - $degree * $factor,
1716 $x1 + $factor, $y1 );
1717 }
1718 else
1719 {
1720 $this->rectangle( $x1, $y1, $params['width'], $params['height'] );
1721 }
1722
1723 $this->setColor( $stackColor );
1724 }
1725
1729 function callSetMargin( $info )
1730 {
1731 $options = array();
1732
1733 eZPDFTable::extractParameters( $info['p'], 0, $options, true );
1734
1735 if ( isset( $options['left'] ) )
1736 {
1737 $this->ez['leftMargin'] = (float)$options['left'];
1738 }
1739
1740 if ( isset( $options['delta_left'] ) )
1741 {
1742 $this->ez['leftMargin'] += $options['delta_left'];
1743 }
1744
1745 if ( isset( $options['right'] ) )
1746 {
1747 $this->ez['rightMargin'] = (float)$options['right'];
1748 }
1749
1750 if ( isset( $options['delta_right'] ) )
1751 {
1752 $this->ez['rightMargin'] += $options['delta_right'];
1753 }
1754
1755 if ( isset( $options['bottom'] ) )
1756 {
1757 $this->ez['bottomMargin'] = (float)$options['bottom'];
1758 }
1759
1760 if ( isset( $options['line_space'] ) )
1761 {
1762 $this->ez['lineSpace'] = (float)$options['line_space'];
1763 }
1764
1765 if ( isset( $options['top'] ) )
1766 {
1767 $this->ez['topMargin'] = (float)$options['top'];
1768 if ( $this->yOffset() < $this->ez['topMargin'] )
1769 {
1770 $this->ez['yOffset'] = (float)$options['y'];
1771 $this->y = (float)$options['y'];
1772 }
1773 }
1774
1775 if ( isset( $options['x'] ) )
1776 {
1777 $this->setXOffset( (float)$options['x'] );
1778 }
1779
1780 if ( isset( $options['y'] ) )
1781 {
1782 $this->ez['yOffset'] = (float)$options['y'];
1783 $this->y = (float)$options['y'];
1784 }
1785
1786 return array( 'x' => $this->xOffset() );
1787 }
1788
1792 function callCircle( $info )
1793 {
1794 $params = array();
1795 $forceYPos = true;
1796
1797 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1798
1799 $keyArray = array ( 'c', 'm', 'y', 'k' );
1800 $cmykColor = explode( ',', $params['cmyk'] );
1801
1802 foreach ( array_keys( $cmykColor ) as $key )
1803 {
1804 $cmykColor[$keyArray[$key]] = $cmykColor[$key];
1805 unset( $cmykColor[$key] );
1806 }
1807
1808 $strokeStackColor = $this->currentStrokeColour;
1809 $this->setStrokeColor( $cmykColor );
1810 $stackColor = $this->currentColour;
1811 $this->setColor( $cmykColor );
1812
1813 if ( $params['x'] == -1 )
1814 {
1815 $params['x'] = $this->xOffset() + $params['radius'];
1816 }
1817 if ( $params['y'] == -1 )
1818 {
1819 $forceYPos = false;
1820 $params['y'] = $this->yOffset();
1821 }
1822 if ( isset( $params['yOffset'] ) )
1823 {
1824 if ( $params['yOffset'] == -1 )
1825 {
1826 $params['y'] += $this->getFontHeight( $this->fontSize() )/2 - $params['radius'];
1827 }
1828 else
1829 {
1830 $params['y'] += $params['yOffset'];
1831 }
1832 }
1833
1834 if ( $params['y'] - $this->getFontHeight( $this->fontSize() ) < $this->ez['bottomMargin'] &&
1835 !$forceYPos )
1836 {
1837 $this->ezNewPage();
1838 return $this->callCircle( $info );
1839 }
1840
1841 $params['x'] += $params['pre_indent'];
1842
1843 $this->filledEllipse( $params['x'], $params['y'], $params['radius'] );
1844
1845 $this->setStrokeColor( $strokeStackColor );
1846 $this->setColor( $stackColor );
1847
1848 if ( isset( $params['indent'] ) )
1849 {
1850 return array( 'x' => $params['x'] + $params['radius'] * 2 + $params['indent'] );
1851 }
1852 else
1853 {
1854 return array( 'x' => $params['x'] + $params['radius'] * 2 );
1855 }
1856
1857 }
1858
1864 function callFilledRectangle( $info )
1865 {
1866 $params = array();
1867
1868 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1869
1870 $keyArray = array ( 'c', 'm', 'y', 'k' );
1871 $cmykTop = explode( ',', $params['cmykTop'] );
1872 $cmykBottom = explode( ',', $params['cmykBottom'] );
1873
1874 foreach ( array_keys( $cmykBottom ) as $key )
1875 {
1876 $cmykBottom[$keyArray[$key]] = $cmykBottom[$key];
1877 unset( $cmykBottom[$key] );
1878 $cmykTop[$keyArray[$key]] = $cmykTop[$key];
1879 unset( $cmykTop[$key] );
1880 }
1881
1882 $this->ezShadedRectangle( $params['x'], $params['y'], $params['width'], $params['height'], $cmykTop, $cmykBottom );
1883 }
1884
1891 function callBlockFrame( $params, $text )
1892 {
1893 if ( strlen( $text ) > 0 )
1894 {
1895 $this->addDocSpecFunction( 'ezInsertBlockFrame', array( $text, $params) );
1896 }
1897 }
1898
1905 function callFrame( $params, $text )
1906 {
1907 if ( strlen( $text ) > 0 )
1908 {
1909 $this->addDocSpecFunction( 'ezInsertFrame', array( $this->fixWhitespace( $text ), $params) );
1910 }
1911 }
1912
1916 function callLine( $params, $text )
1917 {
1918 $this->addDocSpecFunction( 'ezInsertLine', array( $params ) );
1919 }
1920
1924 function callDrawLine( $info )
1925 {
1926 $params = array();
1927 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1928
1929 $this->setLineStyle( $params['thickness'] );
1930 $this->line( $params['x1'], $params['y1'], $params['x2'], $params['y2'] );
1931 }
1932
1938 function callFrameMargins( $info )
1939 {
1940 $params = array();
1941 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
1942
1943 if( isset( $this->ezFrame[$params['identifier']] ) )
1944 {
1945 $this->ezFrame[$params['identifier']] = array_merge( $this->ezFrame[$params['identifier']],
1946 $params );
1947 }
1948 else
1949 {
1950 $this->ezFrame[$params['identifier']] = $params;
1951 }
1952 }
1953
1959 function ezInsertLine( $params )
1960 {
1961 reset( $this->ezPages );
1962 foreach ( $this->ezPages as $pageNum => $pageID )
1963 {
1964 $this->reopenObject($pageID);
1965 $this->line( $params['x1'], $params['y1'], $params['x2'], $params['y2'] );
1966 $this->closeObject();
1967 }
1968 reset( $this->ezPages );
1969 }
1970
1977 function ezInsertBlockFrame( $text, $textParameters )
1978 {
1979 $header = false;
1980 switch( $textParameters['location'] )
1981 {
1982 case 'footer_block':
1983 {
1984 $frameCoords = $this->ezFrame['footer'];
1985 } break;
1986
1987 case 'header_block':
1988 {
1989 $header = true;
1990 $frameCoords = $this->ezFrame['header'];
1991 } break;
1992 }
1993
1994 $text = str_replace( array( ' ', "\t", "\r\n", "\n" ),
1995 '',
1996 urldecode( $text ) );
1997
1998 foreach ( $this->ezPages as $pageNum => $pageID )
1999 {
2000 $this->pushStack();
2001
2002 if ( $header )
2003 {
2004 foreach( $frameCoords as $key => $value )
2005 {
2006 $this->ez[$key] = $value;
2007 }
2008 $this->setYOffset( $this->ez['pageHeight'] - $this->ez['topMargin'] );
2009 }
2010 else
2011 {
2012 $this->ez['topMargin'] = $this->ez['pageHeight'] - $this->ez['bottomMargin'] + $frameCoords['topMargin'];
2013 foreach( $frameCoords as $key => $value )
2014 {
2015 if ( $key != 'topMargin' )
2016 {
2017 $this->ez[$key] = $value;
2018 }
2019 }
2020 }
2021
2022 $this->setXOffset( 0 );
2023
2024 $frameText = $text; //Create copy of text
2025 if( $textParameters['page'] == 'even' &&
2026 $pageNum % 2 == 1 )
2027 continue;
2028 else if ( $textParameters['page'] == 'odd' &&
2029 $pageNum % 2 == 0 )
2030 continue;
2031
2032 if ( strstr( $frameText, self::PAGENUM ) !== false )
2033 {
2034 foreach ( array_keys( $this->PageCounter ) as $identifier )
2035 {
2036 if ( $this->PageCounter[$identifier]['start'] <= $pageNum &&
2037 $this->PageCounter[$identifier]['stop'] >= $pageNum )
2038 {
2039 $frameText = str_replace( self::PAGENUM,
2040 $this->ezWhatPageNumber( $pageNum, $identifier ),
2041 $frameText );
2042
2043 if ( strstr( $frameText, self::TOTAL_PAGENUM ) !== false )
2044 {
2045 $frameText = str_replace( self::TOTAL_PAGENUM,
2046 $this->PageCounter[$identifier]['stop'] - $this->PageCounter[$identifier]['start'] + 1,
2047 $frameText );
2048 }
2049 }
2050 }
2051 }
2052
2053 for( $levelCount = 0; $levelCount < 9; $levelCount++ )
2054 {
2055 if ( strstr( $frameText, self::HEADER_LEVEL.$levelCount ) !== false )
2056 {
2057 $frameText = str_replace( self::HEADER_LEVEL.$levelCount,
2058 $this->headerLabel( $pageNum, $levelCount ),
2059 $frameText );
2060 }
2061
2062 if ( strstr( $frameText, self::HEADER_LEVEL_INDEX.$levelCount ) !== false )
2063 {
2064 $frameText = str_replace( self::HEADER_LEVEL_INDEX.$levelCount,
2065 $this->headerIndex( $pageNum, $levelCount ),
2066 $frameText );
2067 }
2068 }
2069
2070 $this->reopenObject($pageID);
2071 $this->ezText( $frameText );
2072 $this->closeObject();
2073 $this->popStack();
2074 }
2075 }
2076
2083 function ezInsertFrame( $text, $textParameters )
2084 {
2085 $size = $this->fontSize();
2086 if ( isset( $textParameters['size'] ) )
2087 {
2088 $size = $textParameters['size'];
2089 }
2090
2091 $previousFont = $this->currentFont();
2092 if ( isset( $textParameters['font'] ) )
2093 {
2094 $this->selectFont( $textParameters['font'] );
2095 }
2096
2097 $justification = $this->justification();
2098 if ( isset( $textParameters['justification'] ) )
2099 {
2100 $justification = $textParameters['justification'];
2101 }
2102
2103 switch( $textParameters['location'] )
2104 {
2105 case 'footer':
2106 {
2107 $frameCoords =& $this->ezFrame['footer'];
2108 } break;
2109
2110 case 'frame_header':
2111 {
2112 $frameCoords =& $this->ezFrame['header'];
2113 } break;
2114
2115 default:
2116 {
2117 $frameCoords =& $this->ezFrame[0];
2118 } break;
2119 }
2120
2121 foreach ( $this->ezPages as $pageNum => $pageID )
2122 {
2123 if ( $pageNum < $textParameters['pageOffset'] )
2124 continue;
2125
2126 $frameText = $text; //Create copy of text
2127 if( $textParameters['page'] == 'even' &&
2128 $pageNum % 2 == 1 )
2129 continue;
2130 else if ( $textParameters['page'] == 'odd' &&
2131 $pageNum % 2 == 0 )
2132 continue;
2133
2134 $countIdentifier = '';
2135 if ( strstr( $frameText, self::PAGENUM ) !== false )
2136 {
2137 foreach ( array_keys( $this->PageCounter ) as $identifier )
2138 {
2139 if ( $this->PageCounter[$identifier]['start'] <= $pageNum &&
2140 $this->PageCounter[$identifier]['stop'] >= $pageNum )
2141 {
2142 $frameText = str_replace( self::PAGENUM,
2143 $this->ezWhatPageNumber( $pageNum, $identifier ),
2144 $frameText );
2145
2146 if ( strstr( $frameText, self::TOTAL_PAGENUM ) !== false )
2147 {
2148 $frameText = str_replace( self::TOTAL_PAGENUM,
2149 $this->PageCounter[$identifier]['stop'] - $this->PageCounter[$identifier]['start'] + 1,
2150 $frameText );
2151 }
2152 }
2153 }
2154 }
2155
2156 for( $levelCount = 0; $levelCount < 9; $levelCount++ )
2157 {
2158 if ( strstr( $frameText, self::HEADER_LEVEL.$levelCount ) !== false )
2159 {
2160 $frameText = str_replace( self::HEADER_LEVEL.$levelCount,
2161 $this->headerLabel( $pageNum, $levelCount ),
2162 $frameText );
2163 }
2164
2165 if ( strstr( $frameText, self::HEADER_LEVEL_INDEX.$levelCount ) !== false )
2166 {
2167 $frameText = str_replace( self::HEADER_LEVEL_INDEX.$levelCount,
2168 $this->headerIndex( $pageNum, $levelCount ),
2169 $frameText );
2170 }
2171 }
2172
2173 $yOffset = $frameCoords['y0'] - $frameCoords['topMargin'];
2174 if ( $textParameters['newline'] )
2175 {
2176 $yOffset -= $this->getFontHeight( $size );
2177 }
2178
2179 $yOffset -= $this->getFontHeight( $size );
2180 $xOffset = $frameCoords['leftMargin'];
2181 $pageWidth = $this->ez['pageWidth'] - $frameCoords['leftMargin'] - $frameCoords['rightMargin'];
2182
2183 $this->reopenObject($pageID);
2184
2185 $lines = explode( "\n", $frameText );
2186 foreach ( array_keys( $lines ) as $key )
2187 {
2188 $start=1;
2189 $line = $lines[$key];
2190 while (strlen($line) || $start){
2191 $start = 0;
2192 $textInfo = $this->addTextWrap( $xOffset, $yOffset, $pageWidth, $size, $line, $justification );
2193 $line = $textInfo['text'];
2194
2195 if ( strlen( $line ) )
2196 {
2197 $yOffset -= $this->getFontHeight( $size );
2198 }
2199 }
2200 }
2201
2202 $this->closeObject();
2203 }
2204
2205 $this->selectFont( $previousFont );
2206 }
2207
2214 function callFrontpage( $params, $text )
2215 {
2216 $this->addDocSpecFunction( 'insertFrontpage', array( $params, $text ) );
2217 }
2218
2222 function insertFrontpage( $params, $text )
2223 {
2224 $this->saveState();
2225 $closeObject = false;
2226 if ( $this->FrontpageID == null )
2227 {
2228 $this->ezInsertMode(1,1,'before');
2229 $this->ezNewPage();
2230 $this->FrontpageID = $this->currentPage;
2231 }
2232 else if( $this->currentPage != $this->FrontpageID )
2233 {
2234 $this->reopenObject( $this->FrontpageID );
2235 $closeObject = true;
2236 }
2237
2238 $fontSize = $this->fontSize();
2239
2240 $text = $this->fixWhitespace( $text );
2241 $this->setXOffset( 0 );
2242
2243 Cezpdf::ezText( $text, $params['size'], array( 'justification' => $params['justification'],
2244 'top_margin' => $params['top_margin'] ) );
2245
2246 $this->setFontSize( $fontSize );
2247
2248 if ( $closeObject )
2249 {
2250 $this->closeObject();
2251 }
2252 $this->restoreState();
2253 }
2254
2261 function callTable( $params, $text )
2262 {
2263 $textLen = strlen( $text );
2264 $tableData = array();
2265 $cellData = array();
2266 $showLines = 2;
2267 $rowCount = 0;
2268 $columnCount = 0;
2269
2270 $columnText = '';
2271
2272 $keyArray = array ( 'c', 'm', 'y', 'k' );
2273 if ( isset( $params['titleCellCMYK'] ) )
2274 {
2275 $params['titleCellCMYK'] = explode( ',', $params['titleCellCMYK'] );
2276 foreach ( array_keys( $params['titleCellCMYK'] ) as $key )
2277 {
2278 $params['titleCellCMYK'][$keyArray[$key]] = $params['titleCellCMYK'][$key];
2279 unset( $params['titleCellCMYK'][$key] );
2280 }
2281 }
2282
2283 if ( isset( $params['cellCMYK'] ) )
2284 {
2285 $params['cellCMYK'] = explode( ',', $params['cellCMYK'] );
2286 foreach ( array_keys( $params['cellCMYK'] ) as $key )
2287 {
2288 $params['cellCMYK'][$keyArray[$key]] = $params['cellCMYK'][$key];
2289 unset( $params['cellCMYK'][$key] );
2290 }
2291 $params['shaded'] = 2;
2292 $params['shadeCol'] = $params['cellCMYK'];
2293 $params['shadeCol2'] = $params['cellCMYK'];
2294 }
2295
2296 if ( isset( $params['textCMYK'] ) )
2297 {
2298 $params['textCMYK'] = explode( ',', $params['textCMYK'] );
2299 foreach ( array_keys( $params['textCMYK'] ) as $key )
2300 {
2301 $params['textCMYK'][$keyArray[$key]] = $params['textCMYK'][$key];
2302 unset( $params['textCMYK'][$key] );
2303 }
2304 $params['textCol'] = $params['textCMYK'];
2305 }
2306
2307 if ( isset( $params['titleTextCMYK'] ) )
2308 {
2309 $params['titleTextCMYK'] = explode( ',', $params['titleTextCMYK'] );
2310 foreach ( array_keys( $params['titleTextCMYK'] ) as $key )
2311 {
2312 $params['titleTextCMYK'][$keyArray[$key]] = $params['titleTextCMYK'][$key];
2313 unset( $params['titleTextCMYK'][$key] );
2314 }
2315 $params['titleTextCMYK'] = $params['titleTextCMYK'];
2316 }
2317
2318 if ( isset( $params['showLines'] ) )
2319 {
2320 $showLines = $params['showLines'];
2321 }
2322
2323 for ( $offSet = 0; $offSet < $textLen; $offSet++ )
2324 {
2325 if ( $text[$offSet] == '<' )
2326 {
2327 if ( strcmp( substr($text, $offSet+1, strlen( 'tr' ) ), 'tr' ) == 0 )
2328 {
2329 $tableData[] = array();
2330 $offSet++;
2331 $offSet += strlen( 'tr' );
2332 continue;
2333 }
2334 else if ( strcmp( substr($text, $offSet+1, strlen( 'td' ) ), 'td' ) == 0 )
2335 {
2336 $tdParams = array();
2337 $offSet++;
2338 $offSet += strlen( 'td' );
2339 $offSet = eZPDFTable::extractParameters( $text, $offSet, $tdParams );
2340
2341 if ( count( $tdParams ) > 0 )
2342 {
2343 $cellData[$columnCount. ',' .$rowCount] = array();
2344 if ( isset( $tdParams['colspan'] ) )
2345 {
2346 $cellData[$columnCount. ',' .$rowCount]['size'] = (int)$tdParams['colspan'];
2347 }
2348 if ( isset( $tdParams['align'] ) )
2349 {
2350 $cellData[$columnCount. ',' .$rowCount]['justification'] = $tdParams['align'];
2351 }
2352 if ( isset( $tdParams['width'] ) )
2353 {
2354 $cellData[$columnCount. ',' .$rowCount]['width'] = $tdParams['width'];
2355 }
2356 }
2357 continue;
2358 }
2359 else if ( strcmp( substr($text, $offSet+1, strlen( 'th' ) ), 'th' ) == 0 )
2360 {
2361 $thParams = array();
2362 $offSet++;
2363 $offSet += strlen( 'th' );
2364 $offSet = eZPDFTable::extractParameters( $text, $offSet, $thParams );
2365
2366 $cellData[$columnCount. ',' .$rowCount] = array();
2367 $cellData[$columnCount.','.$rowCount]['title'] = true;
2368 if ( isset( $thParams['colspan'] ) )
2369 {
2370 $cellData[$columnCount. ',' .$rowCount]['size'] = (int)$thParams['colspan'];
2371 }
2372 if ( isset( $thParams['align'] ) )
2373 {
2374 $cellData[$columnCount. ',' .$rowCount]['justification'] = $thParams['align'];
2375 }
2376 if ( isset( $thParams['width'] ) )
2377 {
2378 $cellData[$columnCount. ',' .$rowCount]['width'] = $thParams['width'];
2379 }
2380 continue;
2381 }
2382 else if ( strcmp( substr($text, $offSet+1, strlen( '/tr' ) ), '/tr' ) == 0 )
2383 {
2384 $rowCount++;
2385 $columnCount = 0;
2386 $offSet++;
2387 $offSet += strlen( '/tr' );
2388 continue;
2389 }
2390 else if ( strcmp( substr($text, $offSet+1, strlen( '/td' ) ), '/td' ) == 0 )
2391 {
2392 if ( $columnCount == 0 )
2393 {
2394 $tableData[$rowCount] = array();
2395 }
2396 $tableData[$rowCount][$columnCount] = $columnText;
2397 $columnText = '';
2398 $columnCount++;
2399 $offSet++;
2400 $offSet += strlen( '/td' );
2401 continue;
2402 }
2403 else if ( strcmp( substr($text, $offSet+1, strlen( '/th' ) ), '/th' ) == 0 )
2404 {
2405 if ( $columnCount == 0 )
2406 {
2407 $tableData[$rowCount] = array();
2408 }
2409 $tableData[$rowCount][$columnCount] = $columnText;
2410 $columnText = '';
2411 $columnCount++;
2412 $offSet++;
2413 $offSet += strlen( '/th' );
2414 continue;
2415 }
2416 }
2417 $columnText .= $text[$offSet];
2418 }
2419 $this->addDocSpecFunction( 'ezTable', array( &$tableData, '', '', array_merge( array( 'cellData' => $cellData,
2420 'showLines' => $showLines ),
2421 $params ) ) );
2422 }
2423
2434 function extractFunction( &$text, $offSet, &$functionName, &$parameters, $type='ezCall' )
2435 {
2436 $offSet++;
2437 $offSet += strlen( $type.':' );
2438 $funcEnd = strpos( $text, ':', $offSet );
2439 if ( $funcEnd === false || strpos( $text, '>', $offSet ) < $funcEnd )
2440 {
2441 $funcEnd = strpos( $text, '>', $offSet );
2442 }
2443 $functionName = substr( $text, $offSet, $funcEnd - $offSet );
2444
2445 return eZPDFTable::extractParameters( $text, $funcEnd, $parameters );
2446 }
2447
2457 function extractParameters( &$text, $offSet, &$parameters, $skipFirstChar=false )
2458 {
2459 $endOffset = strpos( $text, '>', $offSet );
2460 if ( $endOffset === false )
2461 {
2462 $endOffset = strlen( $text );
2463 }
2464
2465 if ( $skipFirstChar === false )
2466 $offSet++;
2467 while ( $offSet < $endOffset )
2468 {
2469 $nameEnd = strpos( $text, ':', $offSet );
2470 $valueEnd = strpos( $text, ':', $nameEnd+1 );
2471 if ( $valueEnd > $endOffset || $valueEnd === false )
2472 {
2473 $valueEnd = $endOffset;
2474 }
2475 $paramName = substr( $text, $offSet, $nameEnd-$offSet);
2476 ++$nameEnd;
2477 $paramValue = substr( $text, $nameEnd, $valueEnd-$nameEnd );
2478 $parameters[$paramName] = $paramValue;
2479 $offSet = ++$valueEnd;
2480 }
2481
2482 return $endOffset;
2483 }
2484
2490 function outputDocSpecification()
2491 {
2492 foreach( array_keys( $this->DocSpecification ) as $key )
2493 {
2494 $outputElement =& $this->DocSpecification[$key];
2495
2496 $documentSpec =& $outputElement['docSpec'];
2497
2498 if ( isset( $documentSpec['fontName'] ) )
2499 {
2500 $this->selectFont( $documentSpec['fontName'] );
2501 }
2502
2503 if ( isset( $documentSpec['fontSize'] ) )
2504 {
2505 $size = $documentSpec['fontSize'];
2506 }
2507 else
2508 {
2509 $size = $this->fontSize();
2510 }
2511
2512 if ( isset( $documentSpec['cmyk'] ) )
2513 {
2514 $this->setColor( $documentSpec['cmyk'] );
2515 }
2516
2517 if ( isset( $outputElement['isFunction'] ) && $outputElement['isFunction'] === true )
2518 {
2519 $return = call_user_func_array( array( &$this, $outputElement['functionName'] ), $outputElement['parameters'] );
2520 }
2521 else
2522 {
2523 $return = Cezpdf::ezText( $outputElement['text'],
2524 $size,
2525 array( 'justification' => $documentSpec['justification'] ) );
2526 }
2527 }
2528 return $return;
2529 }
2530
2534 function callTextBox( $params, $text )
2535 {
2536 $this->addDocSpecFunction( 'insertTextBox', array( $params, $text ) );
2537 }
2538
2539 function insertTextBox( $params, $text )
2540 {
2541 $this->pushStack();
2542
2543 $this->setYOffset( $params['y'] );
2544 $this->setXOffset( $params['x'] );
2545
2546 $marginText = '<C:callSetMargin';
2547 $marginText .= ':left:' . ( $params['x'] );
2548 $marginText .= ':right:' . ( $this->ez['pageWidth'] - $params['width'] - $params['x'] );
2549 $marginText .= '>';
2550 $marginText .= '<ezCall:callText';
2551 $marginText .= ':size:' . ( isset( $params['size'] ) ? $params['size'] : $this->fontSize() );
2552 $marginText .= ':justification:' . ( isset( $params['align'] ) ? $params['align'] : 'left' );
2553 $marginText .= '>';
2554
2555 $this->ezText( $marginText . $text . '</ezCall:callText>' );
2556
2557 $this->popStack();
2558 }
2559
2563 function callTextFrame( $params, $text )
2564 {
2565 $this->addDocSpecFunction( 'insertTextFrame', array( $params, $text ) );
2566 }
2567
2571 function insertTextFrame( $params, $text )
2572 {
2573 $prevColor = $this->currentColour;
2574 $prevFontSize = $this->fontSize();
2575 $prevFont = $this->currentFont();
2576
2577 if ( isset( $params['fontSize'] ) )
2578 {
2579 $this->setFontSize( $params['fontSize'] );
2580 }
2581
2582 if ( isset( $params['fontName'] ) )
2583 {
2584 $this->selectFont( $params['fontName'] );
2585 }
2586
2587 $cmykKeys = array( 'c', 'm', 'y', 'k' );
2588 if ( isset( $params ['frameCMYK'] ) )
2589 {
2590 $params['frameCMYK'] = explode( ',', $params['frameCMYK'] );
2591 foreach ( $cmykKeys as $oldKey => $newKey )
2592 {
2593 $params['frameCMYK'][$newKey] = $params['frameCMYK'][$oldKey];
2594 unset( $params['frameCMYK'][$oldKey] );
2595 }
2596 }
2597 if ( isset( $params['textCMYK'] ) )
2598 {
2599 $params['textCMYK'] = explode( ',', $params['textCMYK'] );
2600 foreach ( $cmykKeys as $oldKey => $newKey )
2601 {
2602 $params['textCMYK'][$newKey] = $params['textCMYK'][$oldKey];
2603 unset( $params['textCMYK'][$oldKey] );
2604 }
2605 }
2606
2607 $padding = 0;
2608 if ( isset( $params['padding'] ) )
2609 {
2610 $padding = $params['padding'];
2611 }
2612
2613 $leftPadding = $padding;
2614 $rightPadding = $padding;
2615 $topPadding = $padding;
2616 $bottomPadding = $padding;
2617
2618 if ( isset( $params['leftPadding'] ) )
2619 {
2620 $leftPadding = $params['leftPadding'];
2621 }
2622 if ( isset( $params['rightPadding'] ) )
2623 {
2624 $rightPadding = $params['rightPadding'];
2625 }
2626 if ( isset( $params['topPadding'] ) )
2627 {
2628 $topPadding = $params['topPadding'];
2629 }
2630 if ( isset( $params['bottomPadding'] ) )
2631 {
2632 $bottomPadding = $params['bottomPadding'];
2633 }
2634
2635 $yOffset = $this->yOffset();
2636 $xOffset = $this->xOffset();
2637
2638 $fontHeight = $this->getFontHeight( $this->ez['fontSize'] );
2639 $fontDecender = $this->getFontDecender( $this->ez['fontSize'] );
2640 $textWidth = $this->getTextWidth( $this->ez['fontSize'], $text );
2641
2642 $totalHeight = $fontHeight + $topPadding;
2643 $totalWidth = $textWidth + $leftPadding + $rightPadding;
2644
2645 if ( $rightPadding == -1 )
2646 {
2647 $totalWidth = $leftPadding + $this->ez['pageWidth'] - $xOffset + 10;
2648 }
2649
2650 if ( isset( $params['frameCMYK'] ) )
2651 {
2652 $this->setColor( $params['frameCMYK'] );
2653 }
2654 $this->filledRectangle( $xOffset - $leftPadding,
2655 $yOffset - $bottomPadding,
2656 $totalWidth,
2657 $totalHeight );
2658
2659 if ( isset( $params['roundEnds'] ) )
2660 {
2661 if ( $rightPadding != -1 )
2662 {
2663 $this->filledEllipse( $xOffset + $textWidth + $rightPadding, $yOffset - $bottomPadding + ( $totalHeight / 2 ), $totalHeight / 2 );
2664 }
2665 if ( $leftPadding != -1 )
2666 {
2667 $this->filledEllipse( $xOffset - $leftPadding, $yOffset - $bottomPadding + ( $totalHeight / 2 ), $totalHeight / 2 );
2668 }
2669 }
2670
2671 if ( isset( $params['textCMYK'] ) )
2672 {
2673 $this->setColor( $params['textCMYK'] );
2674 }
2675 else
2676 {
2677 $this->setColor( $prevColor );
2678 }
2679 $this->addText( $xOffset, $yOffset, $this->fontSize(), $text );
2680
2681 $this->setColor( $prevColor );
2682 $this->setFontSize( $prevFontSize );
2683 $this->selectFont( $prevFont );
2684 }
2685
2689 function callText( $params )
2690 {
2691 $options = array();
2692
2693 if ( isset( $params['font'] ) )
2694 {
2695 $options['fontName'] = 'lib/ezpdf/classes/fonts/'. $params['font'];
2696 }
2697
2698 if ( isset( $params['size'] ) )
2699 {
2700 $options['fontSize'] = $params['size'];
2701 }
2702
2703 if ( isset( $params['justification'] ) )
2704 {
2705 $options['justification'] = $params['justification'];
2706 }
2707
2708 if ( isset( $params['cmyk'] ) )
2709 {
2710 $keyArray = array ( 'c', 'm', 'y', 'k' );
2711 $options['cmyk'] = array();
2712 $params['cmyk'] = explode( ',', $params['cmyk'] );
2713 foreach ( array_keys( $params['cmyk'] ) as $key )
2714 {
2715 $options['cmyk'][$keyArray[$key]] = $params['cmyk'][$key];
2716 }
2717 }
2718
2719 $this->addToPreStack( $options );
2720
2721 return '';
2722 }
2723
2729 function pushStack( $continous = true)
2730 {
2731 $docSpecArray = array( 'DocSpec' => $this->DocSpecification,
2732 'PreStack' => $this->PreStack,
2733 'LeftMarginArray' => $this->LeftMarginArray,
2734 'RightMarginArray' => $this->RightMarginArray,
2735 'LeftMargin' => $this->ez['leftMargin'],
2736 'RightMargin' => $this->ez['rightMargin'],
2737 'TopMargin' => $this->ez['topMargin'],
2738 'BottomMargin' => $this->ez['bottomMargin'],
2739 'LineSpace' => $this->ez['lineSpace'],
2740 'Continous' => $continous,
2741 'FontSize' => $this->fontSize(),
2742 'Justification' => $this->justification() );
2743 if ( $continous )
2744 {
2745 $docSpecArray['YPos'] = $this->yOffset();
2746 $docSpecArray['XPos'] = $this->xOffset();
2747 }
2748
2749 $this->DocSpecStack[] = $docSpecArray;
2750
2751 $this->PreStack = array( array( 'justification' => $this->justification(),
2752 'fontSize' => $this->fontSize(),
2753 'fontName' => 'lib/ezpdf/classes/fonts/Helvetica',
2754 'cmyk' => eZMath:: rgbToCMYK2( 0, 0, 0 ) ) );
2755 $this->DocSpecification = array();
2756 }
2757
2761 function popStack()
2762 {
2763 $stackArray = array_pop( $this->DocSpecStack );
2764 $this->DocSpecification = $stackArray['DocSpec'];
2765 $this->PreStack = $stackArray['PreStack'];
2766 $this->LeftMarginArray = $stackArray['LeftMarginArray'];
2767 $this->RightMarginArray = $stackArray['RightMarginArray'];
2768 $this->ez['leftMargin'] = $stackArray['LeftMargin'];
2769 $this->ez['rightMargin'] = $stackArray['RightMargin'];
2770 $this->ez['topMargin'] = $stackArray['TopMargin'];
2771 $this->ez['bottomMargin'] = $stackArray['BottomMargin'];
2772 $this->ez['lineSpace'] = $stackArray['LineSpace'];
2773 $this->setFontSize( $stackArray['FontSize'] );
2774 $this->setJustification( $stackArray['justification'] );
2775
2776 if ( $stackArray['continous'] )
2777 {
2778 $this->setYOffset( $stackArray['YPos'] );
2779 $this->setXOffset( $stackArray['XPos'] );
2780 }
2781 }
2782
2788 function addDocSpecification( $text )
2789 {
2790 $docSpec = array_pop( $this->PreStack );
2791 $this->DocSpecification[] = array ( 'docSpec' => $docSpec,
2792 'text' => $text );
2793 $this->PreStack[] = $docSpec;
2794 }
2795
2801 function addDocSpecFunction( $functionName, $parameters )
2802 {
2803 $docSpec = array_pop( $this->PreStack );
2804 $this->DocSpecification[] = array ( 'docSpec' => $docSpec,
2805 'isFunction' => true,
2806 'functionName' => $functionName,
2807 'parameters' => $parameters );
2808 $this->PreStack[] = $docSpec;
2809 }
2810
2811
2820 function addToPreStack( $options=array() )
2821 {
2822 $currentElement = array();
2823
2824 $prevElement = array_pop( $this->PreStack );
2825
2826 if ( isset( $options['justification'] ) )
2827 {
2828 $currentElement['justification'] = $options['justification'];
2829 }
2830 else
2831 {
2832 $currentElement['justification'] = $prevElement['justification'];
2833 }
2834
2835 if ( isset( $options['fontSize'] ) )
2836 {
2837 $currentElement['fontSize'] = $options['fontSize'];
2838 }
2839 else
2840 {
2841 $currentElement['fontSize'] = $prevElement['fontSize'];
2842 }
2843
2844 if ( isset( $options['fontName'] ) )
2845 {
2846 $currentElement['fontName'] = $options['fontName'];
2847 }
2848 else
2849 {
2850 $currentElement['fontName'] = $prevElement['fontName'];
2851 }
2852
2853 if ( isset( $options['cmyk'] ) )
2854 {
2855 $currentElement['cmyk'] = $options['cmyk'];
2856 }
2857 else
2858 {
2859 $currentElement['cmyk'] = $prevElement['cmyk'];
2860 }
2861
2862 $this->PreStack[] = $prevElement;
2863 $this->PreStack[] = $currentElement;
2864 }
2865
2869 function callFrameLine( $info )
2870 {
2871 $parameters = array();
2872 eZPDFTable::extractParameters( $info['p'], 0, $parameters, true );
2873
2874 $location = $parameters['location'];
2875 $yOffset = $parameters['margin'];
2876 if ( $location == 'frame_header' )
2877 {
2878 $yOffset = $this->ez['pageHeight'] - $parameters['margin'];
2879 }
2880
2881 $rightMargin = $this->rightMargin( $yOffset );
2882 if ( isset( $parameters['rightMargin'] ) )
2883 {
2884 $rightMargin = $parameters['rightMargin'];
2885 }
2886
2887 $leftMargin = $this->leftMargin( $yOffset );
2888 if ( isset( $parameters['leftMargin'] ) )
2889 {
2890 $leftMargin = $parameters['leftMargin'];
2891 }
2892
2893 $this->setLineStyle( $parameters['thickness'] );
2894
2895 reset( $this->ezPages );
2896 foreach ( $this->ezPages as $pageNum => $pageID )
2897 {
2898 if( $pageNum < $parameters['pageOffset'] )
2899 continue;
2900
2901 if ( $parameters['page'] == 'odd' &&
2902 $pageNum % 2 == 0 )
2903 continue;
2904
2905 if ( $parameters['page'] == 'even' &&
2906 $pageNum % 2 == 1 )
2907 continue;
2908
2909 $this->reopenObject( $pageID );
2910 $this->line( $leftMargin, $yOffset, $this->ez['pageWidth'] - $rightMargin, $yOffset );
2911 $this->closeObject();
2912 }
2913
2914 $this->setLineStyle( 1 );
2915 }
2916
2922 function callStartPageCounter( $info )
2923 {
2924 $params = array();
2925
2926 eZPDFTable::extractParameters( $info['p'], 0, $params, true );
2927
2928 $identifier = 'main';
2929 if ( isset( $params['identifier'] ) )
2930 {
2931 $identifier = $params['identifier'];
2932 }
2933
2934 if ( isset( $params['start'] ) )
2935 {
2936 $this->PageCounter[$identifier] = array();
2937 $this->PageCounter[$identifier]['start'] = $this->ezGetCurrentPageNumber();
2938 }
2939 if ( isset( $params['stop'] ) )
2940 {
2941 $this->PageCounter[$identifier]['stop'] = $this->ezGetCurrentPageNumber();
2942 }
2943 }
2944
2950 function ezWhatPageNumber( $pageNum, $identifier = false )
2951 {
2952 if ( $identifier === false )
2953 {
2954 foreach ( array_keys( $this->PageCounter ) as $identifier )
2955 {
2956 if ( isset( $this->PageCounter[$identifier]['start'] ) &&
2957 $this->PageCounter[$identifier]['start'] <= $pageNum &&
2958 ( !isset( $this->PageCounter[$identifier]['stop'] ) || $this->PageCounter[$identifier]['stop'] >= $pageNum ) )
2959 return $pageNum - $this->PageCounter[$identifier]['start'] + 1;
2960 }
2961 }
2962 else
2963 return $pageNum - $this->PageCounter[$identifier]['start'] + 1;
2964 }
2965
2974 function headerLabel( $page, $level )
2975 {
2976 $headerLabel = '';
2977 foreach ( array_keys( $this->TOC ) as $key )
2978 {
2979 $header = $this->TOC[$key];
2980 if ( $header['pageNumber'] > $page )
2981 return $headerLabel;
2982
2983 if ( $header['level'] == $level )
2984 {
2985 $headerLabel = $header['label'];
2986 }
2987 else if ( $header['level'] < $level )
2988 {
2989 $headerLabel = '';
2990 }
2991 }
2992
2993 return $headerLabel;
2994 }
2995
3004 function headerIndex( $page, $level )
3005 {
3006 $headerIndex = 0;
3007 foreach ( array_keys( $this->TOC ) as $key )
3008 {
3009 $header = $this->TOC[$key];
3010 if ( $header['pageNumber'] > $page )
3011 return ( $headerIndex != 0 ? $headerIndex : '' );
3012
3013 if ( $header['level'] == $level )
3014 {
3015 $headerIndex++;
3016 }
3017 else if ( $header['level'] < $level )
3018 {
3019 $headerLabel = 0;
3020 }
3021 }
3022
3023 return ( $headerIndex != 0 ? $headerIndex : '' );
3024 }
3025
3026 public $TOC; // Table of content array
3027 public $KeywordArray; // keyword array
3028 public $PageCounter;
3029
3030 public $FrontpageID; // Variable used to store reference to frontpage
3031
3032 public $ezFrame; // array containing frame definitions
3033
3034 /* Stack and array used for preprocessing document */
3035 public $PreStack;
3036 public $DocSpecification;
3037
3038 /* Stack array for recursive ezText calls */
3039 public $DocSpecStack = array();
3040 }
3041
3042
3043 ?>
Cezpdf
Cezpdf provides.
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZImageManager\factory
static factory()
Definition: ezimagemanager.php:1399
eZMath\rgbToCMYK2
static rgbToCMYK2( $r, $g, $b)
Definition: ezmath.php:81
eZMimeType\findByFileContents
static findByFileContents( $url, $returnDefault=true)
Definition: ezmimetype.php:308
eZMimeType\findByURL
static findByURL( $url, $returnDefault=true)
Definition: ezmimetype.php:227
eZPDFTable
eZPDFTable adds extra support for tables
Definition: class.ezpdftable.php:18
eZPDFTable\callTextFrame
callTextFrame( $params, $text)
Definition: class.ezpdftable.php:2563
eZPDFTable\headerLabel
headerLabel( $page, $level)
Definition: class.ezpdftable.php:2974
eZPDFTable\initFrameMargins
initFrameMargins()
Definition: class.ezpdftable.php:67
eZPDFTable\$PageCounter
$PageCounter
Definition: class.ezpdftable.php:3028
eZPDFTable\ezInsertLine
ezInsertLine( $params)
Definition: class.ezpdftable.php:1959
eZPDFTable\HEADER_LEVEL_INDEX
const HEADER_LEVEL_INDEX
Definition: class.ezpdftable.php:27
eZPDFTable\ezPrvtTableDrawLines
ezPrvtTableDrawLines($pos, $gap, $x0, $x1, $y0, $y1, $y2, $col, $inner, $outer, $opt=1)
Definition: class.ezpdftable.php:1075
eZPDFTable\ezInsertBlockFrame
ezInsertBlockFrame( $text, $textParameters)
Definition: class.ezpdftable.php:1977
eZPDFTable\insertTOC
insertTOC( $sizeArray=array(20, 18, 16, 14, 12), $indentArray=array(0, 4, 6, 8, 10), $dots=true, $contentText='', $level=3)
Definition: class.ezpdftable.php:1433
eZPDFTable\pushStack
pushStack( $continous=true)
Definition: class.ezpdftable.php:2729
eZPDFTable\callNewPage
callNewPage( $info)
Definition: class.ezpdftable.php:1387
eZPDFTable\eZCalculateColumnWidth
eZCalculateColumnWidth( $columnWidthArray, $options, $marginWidth, $minWidthArray, $totalWidth, $fixedSizeArray=array())
Definition: class.ezpdftable.php:1029
eZPDFTable\TOTAL_PAGENUM
const TOTAL_PAGENUM
Definition: class.ezpdftable.php:25
eZPDFTable\callAnchor
callAnchor( $info)
Definition: class.ezpdftable.php:1105
eZPDFTable\$PreStack
$PreStack
Definition: class.ezpdftable.php:3035
eZPDFTable\callRectangle
callRectangle( $info)
Definition: class.ezpdftable.php:1647
eZPDFTable\callText
callText( $params)
Definition: class.ezpdftable.php:2689
eZPDFTable\insertTextBox
insertTextBox( $params, $text)
Definition: class.ezpdftable.php:2539
eZPDFTable\callHeader
callHeader( $params)
Definition: class.ezpdftable.php:1115
eZPDFTable\setXOffset
setXOffset( $xOffset)
Definition: class.ezpdftable.php:112
eZPDFTable\callKeyword
callKeyword( $info)
Definition: class.ezpdftable.php:1326
eZPDFTable\fixWhitespace
fixWhitespace(&$text)
Definition: class.ezpdftable.php:1530
eZPDFTable\popStack
popStack()
Definition: class.ezpdftable.php:2761
eZPDFTable\eZPDFTable
eZPDFTable($paper='a4', $orientation='portrait')
Definition: class.ezpdftable.php:58
eZPDFTable\insertTextFrame
insertTextFrame( $params, $text)
Definition: class.ezpdftable.php:2571
eZPDFTable\$fontSize
$fontSize
Definition: class.ezpdftable.php:19
eZPDFTable\SPACE
const SPACE
Definition: class.ezpdftable.php:21
eZPDFTable\callFrameLine
callFrameLine( $info)
Definition: class.ezpdftable.php:2869
eZPDFTable\callLine
callLine( $params, $text)
Definition: class.ezpdftable.php:1916
eZPDFTable\callSetMargin
callSetMargin( $info)
Definition: class.ezpdftable.php:1729
eZPDFTable\extractParameters
extractParameters(&$text, $offSet, &$parameters, $skipFirstChar=false)
Definition: class.ezpdftable.php:2457
eZPDFTable\callIndex
callIndex( $info)
Definition: class.ezpdftable.php:1392
eZPDFTable\addDocSpecFunction
addDocSpecFunction( $functionName, $parameters)
Definition: class.ezpdftable.php:2801
eZPDFTable\ezTable
ezTable(&$data, $cols='', $title='', $options='')
Definition: class.ezpdftable.php:168
eZPDFTable\$TOC
$TOC
Definition: class.ezpdftable.php:3026
eZPDFTable\callFilledRectangle
callFilledRectangle( $info)
Definition: class.ezpdftable.php:1864
eZPDFTable\dots
dots($info)
Definition: class.ezpdftable.php:1475
eZPDFTable\callFont
callFont( $params)
Definition: class.ezpdftable.php:1495
eZPDFTable\callDrawLine
callDrawLine( $info)
Definition: class.ezpdftable.php:1924
eZPDFTable\callTable
callTable( $params, $text)
Definition: class.ezpdftable.php:2261
eZPDFTable\yOffset
yOffset()
Definition: class.ezpdftable.php:88
eZPDFTable\callFrame
callFrame( $params, $text)
Definition: class.ezpdftable.php:1905
eZPDFTable\callTextBox
callTextBox( $params, $text)
Definition: class.ezpdftable.php:2534
eZPDFTable\callCircle
callCircle( $info)
Definition: class.ezpdftable.php:1792
eZPDFTable\__construct
__construct($paper='a4', $orientation='portrait')
Definition: class.ezpdftable.php:37
eZPDFTable\$KeywordArray
$KeywordArray
Definition: class.ezpdftable.php:3027
eZPDFTable\ezWhatPageNumber
ezWhatPageNumber( $pageNum, $identifier=false)
Definition: class.ezpdftable.php:2950
eZPDFTable\callFrameMargins
callFrameMargins( $info)
Definition: class.ezpdftable.php:1938
eZPDFTable\$DocSpecStack
$DocSpecStack
Definition: class.ezpdftable.php:3039
eZPDFTable\fixupTableCellText
fixupTableCellText( $text)
Definition: class.ezpdftable.php:1635
eZPDFTable\NEWLINE
const NEWLINE
Definition: class.ezpdftable.php:20
eZPDFTable\headerIndex
headerIndex( $page, $level)
Definition: class.ezpdftable.php:3004
eZPDFTable\xOffset
xOffset()
Definition: class.ezpdftable.php:96
eZPDFTable\$FrontpageID
$FrontpageID
Definition: class.ezpdftable.php:3030
eZPDFTable\setYOffset
setYOffset( $yOffset)
Definition: class.ezpdftable.php:107
eZPDFTable\addToPreStack
addToPreStack( $options=array())
Definition: class.ezpdftable.php:2820
eZPDFTable\callTOC
callTOC( $info)
Definition: class.ezpdftable.php:1370
eZPDFTable\addDocSpecification
addDocSpecification( $text)
Definition: class.ezpdftable.php:2788
eZPDFTable\PAGENUM
const PAGENUM
Definition: class.ezpdftable.php:24
eZPDFTable\ezText
ezText( $text, $size=0, $options=array(), $test=0)
Definition: class.ezpdftable.php:1545
eZPDFTable\callFrontpage
callFrontpage( $params, $text)
Definition: class.ezpdftable.php:2214
eZPDFTable\callInsertTOC
callInsertTOC( $info)
Definition: class.ezpdftable.php:1350
eZPDFTable\ezInsertFrame
ezInsertFrame( $text, $textParameters)
Definition: class.ezpdftable.php:2083
eZPDFTable\HEADER_LEVEL
const HEADER_LEVEL
Definition: class.ezpdftable.php:26
eZPDFTable\insertFrontpage
insertFrontpage( $params, $text)
Definition: class.ezpdftable.php:2222
eZPDFTable\extractFunction
extractFunction(&$text, $offSet, &$functionName, &$parameters, $type='ezCall')
Definition: class.ezpdftable.php:2434
eZPDFTable\outputDocSpecification
outputDocSpecification()
Definition: class.ezpdftable.php:2490
eZPDFTable\callImage
callImage( $info)
Definition: class.ezpdftable.php:1145
eZPDFTable\callStartPageCounter
callStartPageCounter( $info)
Definition: class.ezpdftable.php:2922
eZPDFTable\TAB
const TAB
Definition: class.ezpdftable.php:22
eZPDFTable\$ezFrame
$ezFrame
Definition: class.ezpdftable.php:3032
eZPDFTable\callBlockFrame
callBlockFrame( $params, $text)
Definition: class.ezpdftable.php:1891
eZPDFTable\$DocSpecification
$DocSpecification
Definition: class.ezpdftable.php:3036
eZSys\cacheDirectory
static cacheDirectory()
Definition: ezsys.php:527
ezpI18n\tr
static tr( $context, $source, $comment=null, $arguments=null)
Definition: ezpi18n.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.