【问题标题】:Snappy / WKHTMLtoPDF - How to change the save folderSnappy / WKHTMLtoPDF - 如何更改保存文件夹
【发布时间】:2017-01-17 23:52:29
【问题描述】:

我正在使用带有 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

【问题讨论】:

    标签: pdf wkhtmltopdf laravel-snappy


    【解决方案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);
    

    【讨论】:

      猜你喜欢
      • 2015-01-31
      • 1970-01-01
      • 2012-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多