How to make pdf exact 10CM width with DOMPDF and Laravel?


I am creating a PDF with DOMPDF and laravel.

The pdf is being printed with a special printer that only accepts files with 10CM width and 20CM height.

I have tried this:

$customPaper = array(0,0,720,1440);
$pdf = PDF::loadView('pdf.retourlabel',compact('retour','barcode'))->setPaper($customPaper);

Since 11X17 is

"11x17" => array(0, 0, 792.00, 1224.00),

I figured 10X20 was 0,0720,1440

But it’s not working.

Any help is appreciated.

Thanks in advance


How i fixed this:

change the custom paper.

Download the PDF open in Acrobat Reader move your mouse to the left corner now you can see the width and height of the document, and i changed the custom paper accordingly.

The end result was:
10CM X 20CM =

$customPaper = array(0,0,567.00,283.80);
$pdf = PDF::loadView('pdf.retourlabel', compact('retour','barcode'))->setPaper($customPaper, 'landscape');

Very circuitous work but i did get the Job done..


Answered By – Rubberduck1337106092

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published