Module HowTo - PDF output




1. Defining possible PDF values

The first step to PDF output is defining what values your module provides. This is needed for the PDF editor, otherwise the user will not be able to select values from your module.

The PDF values are specified with get_pdfFields() or meta['PDF_fields'].

Example:

The ieee802Device module has only one attribute and therefore one PDF value: the MAC address.

    /**
    * Returns meta data that is interpreted by parent class
    *
    * @return array array with meta data
    */
    function get_metaData() {
        $return = array();
[...]
        // available PDF fields
        $return['PDF_fields'] = array(
            'macAddress' => _('MAC address')
        );
        return $return;
    }



2. Providing data to put into the PDF file

When the user wants to create a PDF file the LDAP account is loaded and you module is asked for data to put into the PDF file.

This is done with get_pdfEntries(). Please use one of baseModule::addSimplePDFField/addPDFKeyValue/addPDFTable() for this task.

Example:

The ieee802Device module will return the MAC address list of the account.

    /**
    * Returns a list of PDF entries
    */
    function get_pdfEntries() {
        $return = array();
        $this->addSimplePDFField($return, 'macAddress', _('MAC addresses'));
        return $return;
    }