KnpLabs / KnpSnappyBundle

Easily create PDF and images in Symfony by converting html using webkit
http://knplabs.com
MIT License
1.24k stars 143 forks source link

generate the blank pdf page in symfony 4 #251

Closed balvirsingh closed 4 years ago

balvirsingh commented 5 years ago

Hi,

I used it in symfony4.

Inject the function in controller method like - public function downloadAttendanceList(\Knp\Snappy\Pdf $knpSnappy) {

Call the function to generate pdf of simple text -

return new Response( $knpSnappy->getOutputFromHtml('<h1>test</h1>'), 200, array( 'Content-Type' => 'application/pdf', 'Content-Disposition' => 'inline; filename=filename="test.pdf" ', ) );

It gives the blank pdf in output. I tried with the function - $knpSnappy->generate('http://www.google.in', 'google.pdf');

It works correctly. But the issue is with function 'getOutputFromHtml' only.

Version - Symfony - 4.2.2 knplabs/knp-snappy - v1.1.0
knplabs/knp-snappy-bundle - dev-master 474a2a2

Please help to resolve this issue.

alexpozzi commented 5 years ago

Hello, Sorry but I don't understand what is the issue and what you want to achieve. Can you please give a little bit more details and explain what is the expected result?

I tried to generate a pdf using $knpSnappy->getOutputFromHtml('<h1>test</h1>') and I correctly see the test heading.

Thank you!