if it is working properly in local server, then it also work on live server.
When you are working on live server, it has request time out duration, if the DOMPDF not giving response within time then you show that page.
you need to put the php.ini on the server and in php.ini you have to change this
upload_max_filesize = 2M ;or whatever size you want
max_execution_time = 60 ; also, higher if you must - sets the maximum
time in seconds
use -1 for the infinite time, you can set time whatever your pdf files takes to generate output.
To check and setup php.ini on your server here is your reference
Dude, where's my php.ini?
Another option is genrate html and put it in view and print that file, that is the fastest and easy way to do it.
check this
https://scotch.io/@nagasaiaytha/generate-pdf-from-html-using-jquery-and-jspdf