Я пытаюсь настроить систему генерации файлов pdf
. Для этого я использовал WkHtmlToPdf, а также пакет KnpSnappy.
Это то, что я написал в своей функции внутри моего контроллера:
* @Route("/pdf/{id}", name="room_pdf", methods={"GET"}, requirements={"id"="\d+"})
* @IsGranted("ROLE_ADMIN")
*/
public
function pdf(Room $room, \Knp\ Snappy\ Pdf $knpSnappy) {
$knpSnappy - > setOption("encoding", "UTF-8");
$filename = "mypdf";
$html = $this - > renderView('room/show.html.twig', array(
'room' => $room,
));
return new Response(
$knpSnappy - > getOutputFromHtml($html),
200,
array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'inline; filename="'.$filename.
'.pdf"'
)
);```
So I ended up with a page, almost formatted. The Bootstrap (Grid system & flex) doesn't seems to be supported. According to these:
https://stackoverflow.com/questions/27629710/wicked-pdf-ignores-bootstrap-grid-system
https://github.com/twbs/bootstrap/issues/27642#issuecomment-450479741
https://github.com/twbs/bootstrap/issues/27642
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1522
The thing is, I tried all the solutions I saw. But nothing works.
What can be done ?