Snappy / WKHTMLtoPDF - 如何更改保存文件夹



我正在使用带有活泼包装器的Laravel。除了将PDF保存到公共文件夹中之外,它都可以正常工作。我希望它转到其他文件夹。在活泼的 git 站点上和配置中都没有什么明显的。恕我直言,wkhtlptopdf 文档非常稀疏。如何更改 $pdf->save() 语句,使其转到我想要的位置?

我的PDF是由laravel生成的,如下所示:

 if( $email == 'email'){
        $quotation = $this->quotation->get_PdfQuote($ref);
        $pdf = PDF::loadView('quotations/pdf_quotation',compact('quotation') );
        $pdf->save($ref.'.pdf');  //THIS SAVES INTO THE PUBLIC FOLDER. 
       $title = 'Your Quotation';
       $firstname =  $customer['firstname1'];
       $pathtoFile = '/var/www/auburntree/public/'.$ref.'.pdf';

       Mail::send('emails.quotation', ['title' => $title, 'firstname'=>$firstname ], function ($m) use($customer,$pathtoFile)  {
            $m->from('myemail@gmail.com', 'Auburntree');
            $m->to($customer['email1'],($customer['firstname1'] . $customer['lastname1']))->subject('Your Quotation');
            $m->attach($pathtoFile);
        });
       Flash::success('The Quote Has Been Saved. An Email has ben sent to the customer ');
       return redirect ('quotes');
    } else

好的,我希望这对其他人有所帮助。

        $quotation = $this->quotation->get_PdfQuote($ref);  //pulled in from DB
        $pdf = PDF::loadView('quotations/pdf_quotation',compact('quotation') );
        $filename = base_path('public/pdf/'.$ref.'.pdf');
        $pdf->save($filename);

最新更新