public function initContent() { parent::initContent(); $id = $_GET['id']; $id_lang = $this->context->language->id; $product = new Product((int) $id); $link = new Link(); $url = $link->getProductLink($product); $features = Db::getInstance()->ExecuteS(' SELECT fl.name feature_name, fvl.value feature_value FROM ' . _DB_PREFIX_ . 'feature_product fp LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang=' . $id_lang . ' ) LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang=' . $id_lang . ') WHERE fp.id_product=' . $id); // print_r($features); $images = Image::getImages((int) $id_lang, (int) $product->id); //Limitamos el numero de fotos a cuatro solamente while (count($images) > 3) { $var = array_pop($images); } $this->context->smarty->assign(array('product' => $product, 'lang' => $id_lang, 'image' => $images, 'dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/pdfproduct', 'email' => Configuration::get('PS_SHOP_EMAIL'), 'url' => $url, 'address' => Configuration::get('ADDRESS_SHOP'), 'background' => Configuration::get('BACKGROUND'))); $html = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'pdfproduct/views/templates/front/custom_template_content.tpl'); $dompdf = new DOMPDF(); $dompdf->set_option('enable_remote', TRUE); $dompdf->load_html($html); $dompdf->set_paper('a4', 'portrait'); $dompdf->render(); $dompdf->stream('producto'); //$this->setTemplate('custom_template_content.tpl'); //file_put_contents($filename, $dompdf->output()); //$pdf = new PDF($product, 'CustomPdf', Context::getContext()->smarty); //$img_file = Tools::getHttpHost(true).__PS_BASE_URI__. '/modules/pdfproduct/views/images/background.jpg'; //$pdf->pdf_renderer->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0); //$pdf->render(); }
if (isset($opts["d"])) { $_dompdf_show_warnings = true; $_dompdf_debug = true; } if (isset($opts['t'])) { $arr = split(',', $opts['t']); $types = array(); foreach ($arr as $type) { $types[trim($type)] = 1; } $_DOMPDF_DEBUG_TYPES = $types; } $save_file = true; break; default: $dompdf->set_option('enable_php', false); if (isset($_GET["input_file"])) { $file = rawurldecode($_GET["input_file"]); } else { throw new DOMPDF_Exception("An input file is required (i.e. input_file _GET variable)."); } if (isset($_GET["paper"])) { $paper = rawurldecode($_GET["paper"]); } else { $paper = DOMPDF_DEFAULT_PAPER_SIZE; } if (isset($_GET["orientation"])) { $orientation = rawurldecode($_GET["orientation"]); } else { $orientation = "portrait"; }