dimanche 15 avril 2018

Laravel SnappyPDF image attachment

Im currently using barryvdh/laravel-snappy to convert my data to pdf format.

The code i'm using is :

public function generate_pdf($id){
    $rfq = RFQ::find($id);

    $data = array(
        'rfq' => $rfq,
    );

    //return view('rfq.pdf')->with('rfq', $rfq);

    $pdf = PDF::loadView('rfq.pdf',$data)->setPaper('a4')->setOption('margin-bottom', 0);    
    return $pdf->download($rfq->rfq_no.'-'.date_timestamp_get(date_create()).'.pdf');
}

And then, I have to add an image to the pdf file. So i have to add this line to the pdf.blade.php file.

<img src="">

But then, the image isn't showing properly.

It's visible, but it's opacity is very low, around 0.2.

But when viewing the actual image file, and the one in the actual html template, everything's good.

I tried <img src="data:image/png;base64,"> but still, it's the same.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire