Stud.IP  4.0
 All Data Structures Namespaces Files Functions Variables Groups
ExportPDF Class Reference
Inheritance diagram for ExportPDF:
ExportDocument

Public Member Functions

 __construct ($orientation= 'P', $unit= 'mm', $format= 'A4', $unicode=true, $encoding= 'UTF-8')
 
 addPage ($orientation= '', $format= '', $keepmargins=false, $tocpage=false)
 
 addContent ($content)
 
 addEndnote ($commented_by, $text)
 
 dispatch ($filename)
 
 save ($filename, $folder_id=null)
 
 setHeaderTitle ($title)
 
 setHeaderSubtitle ($subtitle)
 
 setHeaderData ($ln= '', $lw=0, $ht= '', $hs= '', $tc=[], $lc=[])
 
 writeHTML ($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align= '')
 
- Public Member Functions inherited from ExportDocument
 addPage ()
 

Protected Member Functions

 convertURL ($url)
 
 getDomains ()
 

Static Protected Attributes

static $countEndnote = 0
 

Detailed Description

Class to create an PDF by putting in Stud.IP-formatted code. Usage:

$doc = new ExportPDF(); $doc->addPage(); $doc->addContent('Hallo, %wir%% benutzen :studip:-Formatierung.'); $doc->dispatch("test_pdf"); //lines following dispatch won't be accessed anymor, because dispatch //cancels all other output.

Constructor & Destructor Documentation

__construct (   $orientation = 'P',
  $unit = 'mm',
  $format = 'A4',
  $unicode = true,
  $encoding = 'UTF-8' 
)

Create a basic document (without any content so far).

Parameters
string$orientationpage orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation
string$unitUser measure unit. Possible values are:
  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
mixed$formatThe format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
boolean$unicodeTRUE means that the input text is unicode (default = true)
String$encodingcharset encoding; default is UTF-8

Member Function Documentation

addContent (   $content)

Adding Stud.IP formatted code to the current page of the pdf. Remember to call addPage first.

Parameters
string$contentStud.IP formatted code

Implements ExportDocument.

addEndnote (   $commented_by,
  $text 
)
Parameters
<type>$commented_by
<type>$text
Returns
<type>
addPage (   $orientation = '',
  $format = '',
  $keepmargins = false,
  $tocpage = false 
)

Adding a new page to the document. This page can contain even more content than for just one page. The pagebreak will be managed by tcpdf. But this function will create a new pagebreak. Needs to be called at least once to addContent.

Parameters
string$orientationpage orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation
mixed$formatThe format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
boolean$keepmarginsif true overwrites the default page margins with the current margins
boolean$tocpageif true set the tocpage state to true (the added page will be used to display Table Of Content).
convertURL (   $url)
protected

Converts URLs in images so that the webserver can access them without proxy.

Parameters
string$urlof an image
Returns
string " src=\"".$converted_url."""
dispatch (   $filename)

Dispatches the PDF to the user and cancels all other output of Stud.IP.

Parameters
string$filenamename of the future file without the extension.

Implements ExportDocument.

getDomains ( )
protected

finds an array with all domains of this Stud.IP and stores it in $this->domains

save (   $filename,
  $folder_id = null 
)

Saves the content as a file in the filesystem and returns a FileRef object.

Parameters
string$filenamename of the future file without the extension.
mixed$folder_idmd5-id of a given folder in database or null for nothing
Returns
FileRef of the exported file or false if creation of the FileRef or its associated File object failed.

Implements ExportDocument.

setHeaderData (   $ln = '',
  $lw = 0,
  $ht = '',
  $hs = '',
  $tc = [],
  $lc = [] 
)

Creates a header for each page with a custom logo defined

Parameters
string$lnheader image logo
int$lwheader image logo width in mm
string$htstring to print as title on document header
string$hsstring to print on document header
setHeaderSubtitle (   $subtitle)

Sets the subtitle of the header of each page.

Parameters
string$subtitlesubtitle of the head
setHeaderTitle (   $title)

Sets the title of the header of each page.

Parameters
string$titletitle of the head
writeHTML (   $html,
  $ln = true,
  $fill = false,
  $reseth = false,
  $cell = false,
  $align = '' 
)

Overrides writeHTML-method of tcpdf to convert image-urls, so that they aren't accessed via proxy but directly.

Parameters
string$htmltext to display
boolean$lnif true add a new line after text (default = true)
boolean$fillIndicates if the background must be painted (true) or transparent (false).
boolean$resethif true reset the last cell height (default false).
boolean$cellif true add the current left (or right for RTL) padding to each Write (default false).
string$alignAllows to center or align the text. Possible values are:
  • L : left align
  • C : center
  • R : right align
  • '' : empty string : left for LTR or right for RTL

Field Documentation

$countEndnote = 0
staticprotected

The documentation for this class was generated from the following file: