Search code examples
phphttppdfdownloadfpdf

Automatic download of dynamically generated pdf sheets using PHP and FPDF


So my problem is as follows. I have a bunch of articles and every article has a specification sheet.

These sheets are in pdf format and dynamically generated using PHP and the FPDF class. For convenience i would like to automatically generate all articles' (about 200) specification sheets and download them all to a specific file directory.

I tried a solution using PHPs file_get_contents which won't work because the pdf file does not seem to be generated at time of the function call.

I haven't found any suitable solution to this problem so far.


Solution

  • To save files to a folder

    require('fpdf.php');
    
    //create a FPDF object
    $pdf=new FPDF();
    
    $pdf->Output($dir.$filename,'F');
    

    see this question may help you.