Anbu Posted July 21, 2020 Share Posted July 21, 2020 I am trying to print pdf document from php code but error shows warning printer_write() couldn't allocate the printerjob 3003. Here my code $printer = ("Printername"); if($ph = printer_open($printer)) { $file = file_get_contents('test.pdf', FILE_USE_INCLUDE_PATH); printer_write($ph, $file); printer_close($ph); } else { "Couldn't connect..."; } Quote Link to comment Share on other sites More sharing options...
abhasgupta88 Posted July 21, 2020 Share Posted July 21, 2020 This will only work on a Windows Server. Please ensure you're using a windows server and not a linux server for this to work. Quote Link to comment Share on other sites More sharing options...
gw1500se Posted July 21, 2020 Share Posted July 21, 2020 For Linux use the LPR printer class. Quote Link to comment Share on other sites More sharing options...
Anbu Posted July 21, 2020 Author Share Posted July 21, 2020 abhas I am working on windows pc only. Error shows - warning printer_write() couldn't allocate the printerjob 3003. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.