thobea Posted October 1, 2021 Share Posted October 1, 2021 I generate a custom pdf in my custom module in prestashop 1.7. I followed the official doc but I don't find how I can save my pdf in the files of my module. I just use this to display my pdf: $pdf->render(); And I have a PDF class: class HTMLTemplateDevisPdf extends HTMLTemplate { public $param; public function __construct($param, $smarty) { $this->param = $param; // header informations $this->smarty = $smarty; $this->title = HTMLTemplateDevisPdf::l('devis'); } /** * Returns the template's HTML content * @return string HTML content */ public function getContent() { $this->smarty->assign(array( 'test' => "ok", )); return $this->smarty->fetch(_PS_MODULE_DIR_ . 'hcr_devis/views/templates/pdf/devis.tpl'); } public function getLogo() { $this->smarty->assign(array( 'test' => "ok", )); return $this->smarty->fetch(_PS_MODULE_DIR_ . 'my_module/custom_template_logo.tpl'); } public function getHeader() { $this->smarty->assign(array( 'test' => "ok", )); return $this->smarty->fetch(_PS_MODULE_DIR_ . 'hcr_devis/views/templates/pdf/devis_header.tpl'); } /** * Returns the template filename * @return string filename */ public function getFooter() { return $this->smarty->fetch(_PS_MODULE_DIR_ . 'hcr_devis/views/templates/pdf/devis_footer.tpl'); } /** * Returns the template filename * @return string filename */ public function getFilename() { return 'devis.pdf'; } /** * Returns the template filename when using bulk rendering * @return string filename */ public function getBulkFilename() { return 'devis.pdf'; } } I already tried $pdf->Output("name", "F") since prestashop uses tcpdf but it didn't work. Does someone know how I can save my pdf to my files? Link to comment Share on other sites More sharing options...
Futamiya Posted July 21, 2022 Share Posted July 21, 2022 hello did you succeed to display your content on web ? or not ? Link to comment Share on other sites More sharing options...
tdsoft Posted July 22, 2022 Share Posted July 22, 2022 15 hours ago, Futamiya said: hello did you succeed to display your content on web ? or not ? You can use function: $pdf->render('F'); read more: http://www.fpdf.org/en/doc/output.htm Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now