if (isset($cookie->dpdpoland_package_id)) { $package_id = $cookie->dpdpoland_package_id; $printout_format = $cookie->dpdpoland_printout_format; unset($cookie->dpdpoland_package_id); unset($cookie->dpdpoland_printout_format); $cookie->write(); $package = new DpdPolandPackage((int) $package_id); $pdf_file_contents = $package->generateLabels('PDF', $printout_format); ob_end_clean(); header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="package_labels_' . (int) Tools::getValue('id_package_ws') . '.pdf"'); echo $pdf_file_contents; exit; } $package = new DpdPolandPackage((int) Tools::getValue('id_package_ws')); if ($pdf_file_contents = $package->generateLabels()) { $cookie->dpdpoland_package_id = (int) Tools::getValue('id_package_ws'); $printout_format = Tools::getValue('printout_format'); if (!in_array($printout_format, array(DpdPolandConfiguration::PRINTOUT_FORMAT_A4, DpdPolandConfiguration::PRINTOUT_FORMAT_LABEL))) { $printout_format = DpdPolandConfiguration::PRINTOUT_FORMAT_A4; } $cookie->dpdpoland_printout_format = $printout_format; Tools::redirectAdmin(Tools::getValue('returnOnErrorTo') . '&scrollToShipment'); exit; } else { DpdPoland::addFlashError(reset(DpdPolandPackageWS::$errors)); Tools::redirectAdmin(Tools::getValue('returnOnErrorTo') . '&scrollToShipment'); exit; } } if (Tools::isSubmit('downloadModuleCSVSettings')) {