include/Sugarpdf/Sugarpdf.php

Show: inherited
Table of Contents

\Sugarpdf

Package:
Parent(s)
\TCPDF
Children
\ReportsSugarpdfReports
\ProjectSugarpdfProjectgrid
\QuotesSugarpdfQuotes
\SugarpdfSmarty

Constants

Constant  STRETCH_NONE = 0

Stretch options constants

Constant  STRETCH_SCALE = 1
Constant  STRETCH_SCALE_FORCED = 2
Constant  STRETCH_SPACING = 3
Constant  STRETCH_SPACING_FORCED = 4

Properties

Propertypublic  $aclAction= 'PDF_ACL_ACCESS'

Use for the ACL access.

Default valuePDF_ACL_ACCESSDetails
Type
n/a
Propertypublic  $action= ''''

The name of the current action.

Default value''Details
Type
n/a
Propertypublic  $bean= 'null'

Default valuenullDetails
Type
n/a
Propertypublic  $errors= 'array()'

Any errors that occured this can either be set by the view or the controller or the model

Default valuearray()Details
Type
n/a
Propertypublic  $fileName= 'PDF_FILENAME'

Use to set the filename of the output pdf file.

Default valuePDF_FILENAMEDetails
Type
n/a
Propertypublic  $module= ''''

The name of the current module.

Default value''Details
Type
n/a
Propertypublic  $sugarpdf_object_map= 'array()'

This array is meant to hold an objects/data that we would like to pass between the controller and the view. The bean will automatically be set for us, but this is meant to hold anything else.

Default valuearray()Details
Type
n/a

Methods

methodpublicCell(  $w,  $h = 0,  $txt = '',  $border = 0,  $ln = 0,  $align = '',  $fill = 0,  $link = '',  $stretch = 0 ) : void

[OVERRIDE] Cell method in tcpdf library.

Handle charset conversion and HTML entity decode. This method override the regular Cell() method to apply the prepare_string() function to the string to print in the PDF. The cell method is used by all the methods which print text (Write, MultiCell).

Parameters
Name Type Description
$w
$h
$txt
$border
$ln
$align
$fill
$link
$stretch
Details
See
\include/tcpdf/TCPDF#Cell()  
methodpublicHeader( ) : void

[OVERRIDE] This method override the regular Header() method to enable the custom image directory in addition to the OOB image directory.

This method is used to render the page header. It is automatically called by AddPage().

Details
Access
public  
See
\include/tcpdf/TCPDF#Header()  
methodpublicInfo( ) : void

methodpublicLn1( ) : void

This Ln1() method will always print a line break of one line height.

The regular Ln() method print a line break which has the height of the last printed cell.

methodpublicOutput(  $name = 'doc.pdf',  $dest = 'I' ) : void

Disable zlib output compression if we are downloading the PDF.

Parameters
Name Type Description
$name
$dest
Details
See
\TCPDF::Output()  
methodpublicSetFont( string $family, string $style = '', float $size = 0, string $fontfile = '' ) : void

[OVERRIDE] SetFont method in TCPDF Library This method override the regular SetFont() method to enable the custom font directory in addition to the OOB font directory.

Parameters
Name Type Description
$family string

Family font. It can be either a name defined by AddFont() or one of the standard Type1 families (case insensitive):

  • times (Times-Roman)
  • timesb (Times-Bold)
  • timesi (Times-Italic)
  • timesbi (Times-BoldItalic)
  • helvetica (Helvetica)
  • helveticab (Helvetica-Bold)
  • helveticai (Helvetica-Oblique)
  • helveticabi (Helvetica-BoldOblique)
  • courier (Courier)
  • courierb (Courier-Bold)
  • courieri (Courier-Oblique)
  • courierbi (Courier-BoldOblique)
  • symbol (Symbol)
  • zapfdingbats (ZapfDingbats)

It is also possible to pass an empty string. In that case, the current family is retained.

$style string

Font style. Possible values are (case insensitive):

  • empty string: regular
  • B: bold
  • I: italic
  • U: underline
  • D: line trough

or any combination. The default value is regular. Bold and italic styles do not apply to Symbol and ZapfDingbats basic fonts or other fonts when not defined.

$size float

Font size in points. The default value is the current size. If no size has been specified since the beginning of the document, the value taken is 12

$fontfile string

The font definition file. By default, the name is built from the family and style, in lower case with no spaces.

Details
Access
public  
See
\include/tcpdf/TCPDF#SetFont()  
methodpublic__construct(  $bean = null,  $sugarpdf_object_map = array(),  $orientation = PDF_PAGE_ORIENTATION,  $unit = PDF_UNIT,  $format = PDF_PAGE_FORMAT,  $unicode = true,  $encoding = 'UTF-8',  $diskcache = false ) : void

Constructor which will peform the setup.

Parameters
Name Type Description
$bean
$sugarpdf_object_map
$orientation
$unit
$format
$unicode
$encoding
$diskcache
methodpublicdisplay( ) : void

[OVERRIDE] - This method is meant to overidden in a subclass.

methodpublicdisplayErrors( ) : void

This method will display the errors on the page.

methodprivategetLineHeightFromArray( \$line $line, \$width $width ) : \The

Return the heigth of a line depending of the width, the font and the content

Parameters
Name Type Description
$line \$line

Array containing the data of all the cells of the line

$width \$width

Array containing the width of all the cells of the line

Returns
Type Description
\The heigth of the line
methodpublicgetNumLines( string $txt, float $w = 0 ) : int

This is method is fix for a better handling of the count. This method now handle the line break between words.

This method returns the estimated number of lines required to print the text.

Parameters
Name Type Description
$txt string

text to print

$w float

width of cell. If 0, they extend up to the right margin of the page.

Returns
Type Description
int Return the estimated number of lines.
Details
Access
public  
OVERRIDE
 
Since
4.5.011  
methodprivateinitOptionsForWriteCellTable( \$options $options, \$item $item ) : \$options

Private method for writeCellTable which format and initialize the options array.

Parameters
Name Type Description
$options \$options

array

$item \$item

array

Returns
Type Description
\$options array
methodpublicpreDisplay( ) : void

[OVERRIDE] - This method is meant to overidden in a subclass. The purpose of this method is to allow a view to do some preprocessing before the display method is called. This becomes useful when you have a view defined at the application level and then within a module have a sub-view that extends from this application level view. The application level view can do the setup in preDisplay() that is common to itself and any subviews and then the subview can just override display(). If it so desires, can also override preDisplay().

methodpublicprocess( ) : void

This method will be called from the controller and is not meant to be overridden.

methodprivatewrap(  $tag,  $value,  $options ) : \the

return the HTML code of the value wrap with the tag $tag. This method handle options (general and specific)

Parameters
Name Type Description
$tag
$value
$options
Returns
Type Description
\the HTML wrapped code
methodpublicwriteCellTable( \$item $item, \$options $options = NULL ) : void

This method allow printing a table using the MultiCell method with a formatted options array in parameter Options : header options override the regular options for the header's cells - $options['header'] cell options override the regular options for the specific cell - Array[line number (0 to x)][cell header]['options']

Parameters
Name Type Description
$item \$item

Array[line number (0 to x)][cell header] = Cell content OR Array[line number (0 to x)][cell header]['value'] = Cell content AND Array[line number (0 to x)][cell header]['options'] = Array[cell properties] = values

$options \$options

Array which can contain : width (array 'column name'=>'width value + % OR nothing'), isheader (bool), header (array), fill (string: HTML color), ishtml (bool) default: false, border (0: no border (defaul), 1: frame or all of the following characters: L ,T ,R ,B), align (L: left align, C: center, R: right align, J: justification), stretch (array 'column name'=>stretch type)

Details
See
\MultiCell()  
methodpublicwriteHTMLTable( \$item $item, \$returnHtml $returnHtml = false, \$options $options = NULL ) : \the

This method allow printing a table using the writeHTML method with a formatted array in parameter This method can also return the table as HTML code

Parameters
Name Type Description
$item \$item

Array[line number (0 to x)][cell header] = Cell content OR Array[line number (0 to x)][cell header]['value'] = Cell content AND Array[line number (0 to x)][cell header]['options'] = Array[cell properties] = values

$returnHtml \$returnHtml

(bool) Return the table as HTML code instead of printing the HTML table

$options \$options

Array which can contain : table (array of "HTML proprty"=>"value"),td (array of "HTML proprty"=>"value"), tr (array of "HTML proprty"=>"value"), isheader(bool), header (array of "HTML proprty"=>"value"), width (array 'column name'=>'width value + unit OR nothing')

Returns
Type Description
\the HTML code if $returnHtml set to true
Documentation was generated by DocBlox 0.18.1.