LimeSurvey API - Master branch

pdf extends TCPDF
in package

Table of Contents

Properties

$_aSurveyInfo  : array<string|int, mixed>
Survey Information (preventing from passing to methods every time)
$_config  : array<string|int, mixed>
Settings from our APPPATH/config/tcpdf.php file
$_ibaseAnswerFontSize  : int
Base font size for answer PDF export
$_iCellHeight  : int
Cell height for answer PDF export
$cfg_constant_map  : array<string|int, mixed>
TCPDF system constants that map to settings in our config file

Methods

__construct()  : mixed
Initialize and configure TCPDF with the settings in our config file
addAnswer()  : void
Add answer to PDF
addGidAnswer()  : void
Add GID text to PDF
addHeader()  : void
Add header to pdf
addTitle()  : void
Add title to pdf
delete_html()  : mixed
equalTable()  : void
Creates a Table with equal cell width.
getEqualWidth()  : mixed
gets the width for each column in tables, based on pagewidth and count of columns.
getFullWidth()  : array<string|int, mixed>
Gets the width for columns in a table based on their Stringlength and the width of the page.
getmaxwidth()  : mixed
getminwidth()  : mixed
Header()  : mixed
headTable()  : void
creates a table with a bold head using the full width of page
initAnswerPDF()  : void
Create Answer PDF document, set metadata and set title
intopdf()  : void
setConfig()  : mixed
Set _config for pdf
tablehead()  : void
Creates a Table with equal cell width and Bold text. Used as Head for equalTable()
tableintopdf()  : void
Creates a table using the full width of page
titleintopdf()  : void
Writes a big title in the page + description
write_out()  : mixed

Properties

$_aSurveyInfo

Survey Information (preventing from passing to methods every time)

private array<string|int, mixed> $_aSurveyInfo = array()
Tags
access

private

$_config

Settings from our APPPATH/config/tcpdf.php file

private array<string|int, mixed> $_config = array()
Tags
access

private

$_ibaseAnswerFontSize

Base font size for answer PDF export

private int $_ibaseAnswerFontSize = 12
Tags
access

private

$_iCellHeight

Cell height for answer PDF export

private int $_iCellHeight = 6
Tags
access

private

$cfg_constant_map

TCPDF system constants that map to settings in our config file

private array<string|int, mixed> $cfg_constant_map = array('K_PATH_MAIN' => 'base_directory', 'K_PATH_URL' => 'base_url', 'K_PATH_FONTS' => 'fonts_directory', 'K_PATH_CACHE' => 'cache_directory', 'K_PATH_IMAGES' => 'image_directory', 'K_BLANK_IMAGE' => 'blank_image', 'K_SMALL_RATIO' => 'small_font_ratio')
Tags
access

private

Methods

__construct()

Initialize and configure TCPDF with the settings in our config file

public __construct() : mixed

addAnswer()

Add answer to PDF

public addAnswer(string $sQuestion, string $sResponse[, bool $bReplaceExpressions = true ][, bool $bAllowBreakPage = false ]) : void
Parameters
$sQuestion : string
  • Question field text array
$sResponse : string
  • Answer field text array
$bReplaceExpressions : bool = true
  • Try to replace LimeSurvey Expressions. This is false when exporting answers PDF from admin GUI because we can not interpret expressions so just purify. TODO: Find a universal valid method to interpret expressions
$bAllowBreakPage : bool = false
  • Allow break cell in two pages

addGidAnswer()

Add GID text to PDF

public addGidAnswer( $sGroupName, string $sGroupDescription[,  $bAllowBreakPage = false ]) : void
Parameters
$sGroupName :
  • Group name
$sGroupDescription : string
  • Group description
$bAllowBreakPage : = false
  • Allow break cell in two pages

addHeader()

Add header to pdf

public addHeader(array<string|int, mixed> $aPdfLanguageSettings, string $sSiteName, string $sDefaultHeaderString) : void
Parameters
$aPdfLanguageSettings : array<string|int, mixed>
  • Pdf language settings
$sSiteName : string
  • LimeSurvey site name (header and metadata)
$sDefaultHeaderString : string
  • TCPDF header string

addTitle()

Add title to pdf

public addTitle(string $sTitle[, string $sSubtitle = "" ]) : void
Parameters
$sTitle : string
  • Title
$sSubtitle : string = ""
  • Subtitle

delete_html()

public delete_html(mixed $text) : mixed
Parameters
$text : mixed

equalTable()

Creates a Table with equal cell width.

public equalTable( $array[, int $modulo = 1 ]) : void
Parameters
$array :
  • table array( 0=> array("td", "td", "td"), 1=> array("td", "td", "td"))
$modulo : int = 1
  • fills each second row with a light-grey for better visibility. Default is on turn off with 0

getEqualWidth()

gets the width for each column in tables, based on pagewidth and count of columns.

public getEqualWidth( $array) : mixed

Good for static tables with equal value String-length

Parameters
$array :

getFullWidth()

Gets the width for columns in a table based on their Stringlength and the width of the page.

public getFullWidth( $array) : array<string|int, mixed>

..

Parameters
$array :
Return values
array<string|int, mixed>

with column width

getmaxwidth()

public getmaxwidth(mixed $array) : mixed
Parameters
$array : mixed

getminwidth()

public getminwidth(mixed $array) : mixed
Parameters
$array : mixed

Header()

public Header() : mixed

headTable()

creates a table with a bold head using the full width of page

public headTable( $head,  $table[,  $modulo = 1 ]) : void
Parameters
$head :
  • head array( 0=> array("th", "th", "th"))
$table :
  • table array( 0=> array("td", "td", "td"), 1=> array("td", "td", "td"))
$modulo : = 1
  • fills each second row with a light-grey for better visibility. Default is on, turn off with 0

initAnswerPDF()

Create Answer PDF document, set metadata and set title

public initAnswerPDF(array<string|int, mixed> $aSurveyInfo, array<string|int, mixed> $aPdfLanguageSettings, string $sSiteName, string $sSurveyName[, string $sDefaultHeaderString = '' ]) : void
Parameters
$aSurveyInfo : array<string|int, mixed>
  • Survey Information (preventing from passing to methods every time)
$aPdfLanguageSettings : array<string|int, mixed>
  • Pdf language settings
$sSiteName : string
  • LimeSurvey site name (header and metadata)
$sSurveyName : string
  • Survey name (header, metadata and title),
$sDefaultHeaderString : string = ''
  • TCPDF header string

intopdf()

public intopdf(string $text[,  $format = '' ]) : void
Parameters
$text : string
$format : = ''
Tags
deprecated

setConfig()

Set _config for pdf

public setConfig(mixed $tcpdf) : mixed
Parameters
$tcpdf : mixed
Tags
access

public

tablehead()

Creates a Table with equal cell width and Bold text. Used as Head for equalTable()

public tablehead(mixed $array) : void
Parameters
$array : mixed

tableintopdf()

Creates a table using the full width of page

public tableintopdf( $array[,  $modulo = 1 ]) : void
Parameters
$array :

Table array( 0=> array("td", "td", "td"), 1=> array("td", "td", "td"))

$modulo : = 1

Fills each second row with a light-grey for better visibility. Default is off, turn on with 1

titleintopdf()

Writes a big title in the page + description

public titleintopdf( $title[,  $description = '' ]) : void
Parameters
$title :
$description : = ''

write_out()

public write_out(mixed $name) : mixed
Parameters
$name : mixed

        
On this page

Search results