wil
wil

Reputation: 55

which is the equivalence of measurements in cm or mm for DOMPDF

I am using laravel, barryvdh / laravel-dompdf to generate a pdf. But I need to configure my paper size to measurements the customer.

which is the equivalence of measurements in cm or mm.

I configure some measures, I found:

$pdf = PDF::loadView('view.factura', ['data'=>$data] )->setPaper([0,0,500,1000]);

but I need to export it in paper size:

10.16 cm x 33 cm.

in setPaper([0,0,500,1000] = what would be the equivalence to organize my measurements

what would the equivalence be? where can i learn from this? Thank you.

Can this tool help me? https://www.blitzresults.com/es/pixel/

setting my pdf to 150dpi?

->setOptions(['dpi' => 150, 'isRemoteEnabled' => true])->setPaper([0,0,600,1949])

¿are this measurements equivalence: 10.16 cm x 33 cm = 600 x 1949?

Upvotes: 5

Views: 1290

Answers (1)

Midhun Raj
Midhun Raj

Reputation: 987

Dompdf seems to use points as measuring unit.so you can convert it into points using some cm to point converters like Online cm to point converter

and so please try this code

 $pdf = PDF::loadView('view.factura', ['data'=>$data] )
   ->setOptions(['dpi' => 150, 'isRemoteEnabled' => true])
    ->setPaper([0,0,288,935.43])

And dpi has nothing to do with paper size.

Upvotes: 4

Related Questions