Laravel-snappy: Custom PDF size

Created on 17 Aug 2015  路  6Comments  路  Source: barryvdh/laravel-snappy

Hi!

How can I set the size of the PDF? I need it to be 25x54mm.

stale

Most helpful comment

i use this
$pdf = SnappyPdf::loadView('salidas.pdf', compact('salida', 'title'))
->setOption('page-width', '215.9')
->setOption('page-height', '139.7');

All 6 comments

Does anyone know? I see from the documentation that I can use "page-height", but how do I set it with the facade?

i use this
$pdf = SnappyPdf::loadView('salidas.pdf', compact('salida', 'title'))
->setOption('page-width', '215.9')
->setOption('page-height', '139.7');

What unit of measurement is this, btw? I want to make it A4 Size or Legal Size

What unit of measurement is this, btw? I want to make it A4 Size or Legal Size

You can use setPaper('a4') function for setting it to A4.

I know this is a long-ago post, but just to answer the question after a trial and error, the setOption() unit of measurement is mm

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/KnpLabs/snappy instead. When having doubts, please try to reproduce the issue with just snappy.
If you believe this is an actual issue with the latest version of laravel-snappy, please reply to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hilmanfaiz picture hilmanfaiz  路  5Comments

oscarAG picture oscarAG  路  4Comments

jerearaujo03 picture jerearaujo03  路  5Comments

zhuojiawei picture zhuojiawei  路  5Comments

samsoft00 picture samsoft00  路  3Comments