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

时间:2017-01-17 23:52:29

标签: pdf wkhtmltopdf laravel-snappy

我正在使用Laravel和snappy包装器。除了将PDF保存到公共文件夹之外,它都可以正常工作。我希望它转到另一个文件夹。在snappy git网站上,在配置中没有任何明显的东西。并且wkhtlptopdf文档是非常稀疏的imho。如何更改 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是由laravel生成的:

Private Sub btnProcess_Click(sender As Object, e As EventArgs) Handles btnProcess.Click
    Dim input As String = txtNumber.Text

    If DataOk() Then
        lstOutput.Items.Clear()
        lstOutput.Items.Add(input)
    End If

End Sub
Function DataOk() As Boolean
    Dim number As String = txtNumber.Text
    If number = "" Then
        MessageBox.Show("Must not be blank")
        txtNumber.Focus()
    ElseIf CInt(number) > 10 Then
        MessageBox.Show("Number must be less than 10")
        txtNumber.Focus()
    ElseIf CInt(number) < 3 Then
        MessageBox.Show("Number must be greater than 3")
        txtNumber.Focus()
        Return False
    End If
    Return True
End Function

1 个答案:

答案 0 :(得分:0)

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

        $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);