mercredi 7 octobre 2015

laravel domPDF I cannot save the pdf to directory

can someone help me on this I tried this laravel-dompdf to use in my project. I want to generate pdf file then save it to directory,I have piece of code here in my Controller but it doesn't work.I will get error "file_get_contents() cannot open ....etc) .I apologize I forgot the error.

public function GeneratePDF(){

    $html='<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <style>
            @page { margin-bottom: 50px; }
            .footer { position: fixed; bottom: -50px; margin: 10px; }
        </style>
    </head>
    <body>
    <h1>Test</h1>
    <h2>section 1</h2>
    <div style="page-break-before: always;"></div>
    <div class="footer"></div>
    <h2>section 2</h2>
    </body>
    </html>';



return  PDF::loadHTML($html)->setPaper('a4')->setOrientation('landscape')->setWarnings(false)->save('c:\myfile.pdf');

}

Thank you in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire