Mpdf: Destination directory for saving files in $mpdf->Output();

Created on 1 Feb 2017  路  3Comments  路  Source: mpdf/mpdf

I realy love this class
Only problem i have is to save my PDF files to a specific diretory.
when i set de $dest ($location) in $mpdf->Output i get a error 500
When i look at the logs i see :

Mpdf\Mpdf->Output('T - autoleasece...', '/HOME/*.....')\n#1 {main}\n thrown in /public_html/rap/vendor/MPDF/src/Mpdf.php on line 9098\n

These are mPDF and PHP versions I am using

MPDF V7.0
PHP V7.0

This is a PHP code snippet I use

<?php
    $location = __DIR__ .'/assets/pdf/';
    require_once __DIR__ . '/vendor/MPDF/vendor/autoload.php';
    $mpdf = new \Mpdf\Mpdf();

    $mpdf->setAutoTopMargin = 'stretch';

    $mpdf->SetHTMLHeader($function->WebtonHeader());
    $mpdf->WriteHTML($function->WebtonBody().$content);
    $mpdf->SetHTMLFooter($function->AllFooter('Webton Internerdesign'));        

    $mpdf->Output('test.pdf',$location);

Most helpful comment

Use the entire path to your output file in the first Output parameter. Use \Mpdf\Output\Destination::FILE as the second parameter - the second parameters marks HOW to output the file:

$mpdf->Output($location . 'test.pdf', \Mpdf\Output\Destination::FILE);

All 3 comments

Use the entire path to your output file in the first Output parameter. Use \Mpdf\Output\Destination::FILE as the second parameter - the second parameters marks HOW to output the file:

$mpdf->Output($location . 'test.pdf', \Mpdf\Output\Destination::FILE);

Hi @finwe and all masters , how to implement
$mpdf->Output($location . 'test.pdf', \Mpdf\Output\Destination::INLINE);
in mPDF v.6.1.4 ?

Thanks in Advance Brothers..

By the way i have post new issue (question) here : https://github.com/mpdf/mpdf/issues/1127#issue-527366505 .
I will appreciate either answered here or there.

Please note that the Issue tracker serves mainly as a place to report bugs and request new features as noted in Contributing guidelines. Please do not abuse it as a general questions or troubleshooting location.

Use the the mpdf tag at Stack Overflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blacksheep-dev picture blacksheep-dev  路  4Comments

maofree picture maofree  路  3Comments

BernhardBaumrock picture BernhardBaumrock  路  3Comments

vtulse picture vtulse  路  5Comments

pablinho81 picture pablinho81  路  3Comments