function mainPdf($itemtype, $tab_id, $save = 0, $saveas = 0) { global $PDF, $DB; $config = new PluginImmobilizationsheetsConfig(); $nb_id = count($tab_id); foreach ($tab_id as $key => $ID) { $itemtable = getTableForItemType($itemtype); $PDF = new Cezpdf(); $PDF->Cezpdf('a4', 'portrait'); $PDF->selectFont(GLPI_ROOT . '/lib/ezpdf/fonts/Helvetica.afm'); $PDF->ezStartPageNumbers(550, 10, 10, 'left', "GLPI PDF export - " . date("Y-m-d H:i:s") . " - " . Toolbox::decodeFromUtf8(__('Items')) . "- {PAGENUM}/{TOTALPAGENUM}"); //items $query = "SELECT *\n FROM `" . $itemtable . "`\n WHERE `id` = '{$ID}'"; $result = $DB->query($query); $number = $DB->numrows($result); if ($number != 0) { while ($data = $DB->fetch_array($result)) { $this->generatePdf($itemtype, $data, $saveas); } } if ($config->getFromDB(1)) { if ($config->fields["use_backup"] != 1) { if ($nb_id != $key + 1) { $PDF->ezNewPage(); } } } } if ($save == 0) { $PDF->ezstream(); } }