Frank Schneider Posted December 26, 2021 Share Posted December 26, 2021 i create a pdf file with WirePdf on PW andand want it download to browser downloads folder. $header = ''; $footer = $pages->get("/einstellungen/")->company_name; $filename = 'Ausgabe.pdf'; error_reporting(0); // E_ALL=Melde alle PHP-Fehler 0=deaktiviert ob_start(); ob_clean(); $pdf = $modules->get('WirePDF'); $pdf->pageFormat = 'A4'; $pdf->leftMargin = 20; $pdf->rightMargin = 20; $pdf->topMargin = 20; $pdf->bottomMargin = 20; $mpdf = $pdf->mpdf; $mpdf->SetHTMLHeader($header); $mpdf->SetHTMLFooter($footer); $mpdf->WriteHTML($content); ob_end_clean(); $mpdf->Output($filename, 'F'); $mpdf->Output($filename, 'F'); works and create in template folder. $mpdf->Output(); not working and the browser shows, annot load file. Know anyone the reason. Ist it a parameter in PW? Link to comment Share on other sites More sharing options...
adrian Posted December 26, 2021 Share Posted December 26, 2021 I use "I" for "inline" when I want it to show in the browser. Still specifying a filename. Curious about the WirePDF module though - where did you get that? Link to comment Share on other sites More sharing options...
Frank Schneider Posted December 26, 2021 Author Share Posted December 26, 2021 I've also tried the parameters I, D and F the same. It must be an attitude, but where. WirePDF I installed it via Modules-> Site-> New-> Add Module Manualy Link to comment Share on other sites More sharing options...
Jan Romero Posted December 27, 2021 Share Posted December 27, 2021 Looks like you’re using @Wanze’s module Pages2Pdf. Unfortunately that module is pretty outdated and not compatible with PHP 8. I recommend switching to @bernhard’s RockPdf: $pdf = $modules->get('RockPdf'); $pdf->settings([ 'mode' => 'utf-8', 'format' => [210, 297], 'margin_top' => 20, 'margin_bottom' => 20, 'margin_left' => 20, 'margin_right' => 20, ]); $pdf->write("<h1>{$page->title}</h1>"); $pdf->write($page->body); $pdf->download($page->name . '.pdf'); It comes with handy output methods: Quote You can use these methods to output your pdf files: save() to save your file to the file system show() to directly show your file in the browser download() to force the browser to download the pdf 2 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