wkhtmltopdf Knp-snappy custom height/width which unit is expected?

pdf, php, symfony

Solution

`--page-width` and `--page-height` take real world units (as in cm, not pixels)

`--page-size` takes values like "A4", "A5", "Letter", etc.

Although it's probably easier not to touch these values and just play around with the layout you're using, or maybe use `--zoom`, but I'd definitely go for tweaking the layout (maybe have a layout or CSS file specific for generating the PDF)

Problem

I´m generating pdf´s from html-pages and i want to set a specific width and height to each page of the pdf, i found nothing on the web, but in the bundle theres a pdf.php with ``` protected function configure() ``` where these configurations are : ``` 'page-height' => null, 'page-size' => null, 'page-width' => null, ``` so i dont know which unit is expected so if i set it to ``` 'page-height' => 600, 'page-width' => 1000, ``` where i generate the pdf, it gets much too large, so it cant be pixels maybe it has to do with any other option ? heres my call : ``` $pdfString=$this->knp_snappy->getOutputFromHtml($html, array( 'orientation' => 'landscape', 'enable-javascript' => true, 'javascript-delay' => 1000, 'no-stop-slow-scripts' => true, 'no-background' => false, 'lowquality' => false, 'page-height' => 600, 'page-width' => 1000, 'encoding' => 'utf-8', 'images' => true, 'cookie' => array(), 'dpi' => 300, 'image-dpi' => 300, 'enable-external-links' => true, 'enable-internal-links' => true )); ``` I need to have a specific height because now the charts i draw are cut because i dont know the exact height of the generated pdf for any help, thanks in advance!

Original source