1

我正在使用带有 snappy 包装器的 Laravel。除了将 PDF 保存到公用文件夹之外,一切正常。我希望它转到另一个文件夹。在 snappy 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
4

1 回答 1

1

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

        $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);
于 2017-01-18T18:59:31.467 回答