$filename= "{$membership->id}.pdf"; $filelocation = "D:\\wamp\\www\\project\\custom";//windows $filelocation = "/var/www/project/custom"; //Linux $fileNL = $filelocation."\\".$filename;//Windows $fileNL = $filelocation."/".$filename; //Linux $this->pdf->Output($fileNL, 'F');