Coupon-style PDF size

Asked

Viewed 421 times

0

I need to create a coupon style PDF, to send to a Daruma DR800 non-fiscal printer.

I need to know how to generate a custom sized PDF and its contents. I already generate PDF with DOMPDF in Laravel 5.5.

Example of how to generate any PDF:

public function printSimple($id)
{
    $sale = $this->sale::where('id', $id)->with('user', 'customer', 'products', 'promissory')->get()->first();
    $company = Company::find(1);
    $view = view('sale.print-simple', compact('sale', 'company'));
    $pdf = PDF::loadHTML($view)->setPaper('a4');
    return $pdf->stream();
}

Style this image: inserir a descrição da imagem aqui

  • you have the code of this coupon?

1 answer

1


You can pass the paper size as follows:

 ->setPaper([0, 0, 807.874, 221.102], 'landscape')
  • It worked out, thanks buddy.

  • I made this configuration and it worked, but the height of the coupon is always the size of an A4, I wonder if it has to leave the height in a dynamic way, because when the product has only 1 or 2 products is a whole white space left below.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.