laravel-dompdf icon indicating copy to clipboard operation
laravel-dompdf copied to clipboard

show barcode and title in one paper with barryvdh/laravel-dompdf

Open atrialabir opened this issue 1 year ago • 2 comments

I use barryvdh/laravel-dompdf package in laravel to make pdf files and print them.

my printer machine print barcode in small dimension like 45mm * 30mm

I use this code to make pdf like

        $pdf = new Dompdf(new Options(['dpi' => 200]));
        $pdf->loadHtml('
        <img  src="data:image/png;base64,' . base64_encode($barcode) . '">
        <br/>
        <span style="text-align:center;">' . $code . '</span>
        <br/>
        <span>' . $product->name . '(' . $brand->name . ')</span>
        ');
        $pdf->setPaper([0, 0, 127, 85]);
        $pdf->render();

        $name = $code . '.pdf';
        $path = 'barcodes/' . $name;
        Storage::disk('public')->put($path, $pdf->output());

and the result is:

enter image description here

how can I fit all content in one page not three page

atrialabir avatar May 18 '23 09:05 atrialabir

https://github.com/barryvdh/laravel-dompdf/blob/424a223ce80e7afc8bfb6e84449679efe272fbb5/.github/ISSUE_TEMPLATE/bug_report.md?plain=1#L10-L12

This is just a Dompdf wrapper! I understand that this package is just a Laravel wrapper for https://github.com/dompdf/dompdf Any issues with PDF rendering, CSS that is not applied correctly, aligning/fonts/characters etc that are not directly related to this package, should be reported there. When having doubts, please try to reproduce the issue with just dompdf. If it's also present there, do not open an issue here please.

parallels999 avatar May 19 '23 13:05 parallels999

@atrialabir Setup your template (HTML & CSS) so that it creates a template to suit your labels dimensions.

ntaylor-86 avatar Jun 26 '23 05:06 ntaylor-86