Space before %pdf in snappy pdf generation

357 views Asked by At

I am using Snappy pdf and all things are working fine but I tried to upload on some websites then it says "PDF header is not at the start of file". I analyzed this error and found that this is because when i generate the pdf file then the pdf is taking space before the %pdf syntax. I opened the generated pdf in the notepad++.

My config file is like this

 return array(
'pdf' => array(
    'enabled' => true,
    'binary'  => base_path('vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64'),
    'timeout' => false,
    'options' => array(),
    'env'     => array(),
    'margin-top' => 0,
    'margin-right' => 0,
    'margin-bottom' => 0,
    'margin-left' => 0,
),

PDF Generation Code

$pdf = App::make('snappy.pdf.wrapper');
$pdf->loadHTML($v);
$pdf->download($fv->slug_url.".pdf");

Could you please help me to find a solution on how to remove this space when the pdf generate

0

There are 0 answers