I am trying to generate a pdf from a twig page by using snappy bundle with wkhtmltopdf,:
$pageUrl = $command->getRouter()->generate('testDevis',array('idDevis'=>$command->getIdDevis()),UrlGeneratorInterface::ABSOLUTE_URL);
return new PdfResponse(
$command->getPdfService()->getOutput($pageUrl),
$nomDevis
);
where $pageUrl = http://127.0.0.1:9999/test/1.I believe the problem came from Docker, where I have configured the port in docker-compose.yml as below:
build:
context: ./.docker/apache
image: apache-symfony4-mpapws
container_name: dps-cf
ports:
- "9999:80"
volumes:
- "./:/var/www/html/dps-cf"
networks:
- dps-cf-network
This is the full error message given:
The exit status code '1' says something went wrong:
stderr: "Loading pages (1/6)
[> ] 0%
[======> ] 10%
Error: Failed to load http://127.0.0.1:9999/test/1, with network status code 1 and http status code 0 - Connection refused
Error: Failed loading page http://127.0.0.1:9999/test/1 (sometimes it will work just to ignore this error with --load-error-handling ignore)
Exit with code 1 due to network error: ConnectionRefusedError
"
stdout: ""
command: /usr/local/bin/wkhtmltopdf --lowquality 'http://127.0.0.1:9999/test/1' '/tmp/knp_snappy5e7fcc85390159.73192155.pdf'.
I kindly thank you in advance for helping me.