Pearl123 Posted August 18, 2022 Share Posted August 18, 2022 Hi to all, I am trying to create a report using php and then automatically send to network printer using default printer. I am using one library but that library does not support html page simple raw text can be printed automatically. Any help? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/ Share on other sites More sharing options...
ginerjm Posted August 18, 2022 Share Posted August 18, 2022 Are you using PHP from a server/host rather than on your local client? If so then php cannot do that since it won't have control over things at the client level. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599561 Share on other sites More sharing options...
Barand Posted August 18, 2022 Share Posted August 18, 2022 If I want to create something that needs to printed (report, invoice etc) I create it with PHP as a PDF file, download, then print. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599562 Share on other sites More sharing options...
ginerjm Posted August 19, 2022 Share Posted August 19, 2022 Exactly! Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599571 Share on other sites More sharing options...
Pearl123 Posted August 19, 2022 Author Share Posted August 19, 2022 Yes i have converted html to pdf want to automatically print that pdf after pdf creation through php but no success till now Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599577 Share on other sites More sharing options...
Barand Posted August 19, 2022 Share Posted August 19, 2022 Download the pdf and print from there. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599579 Share on other sites More sharing options...
Pearl123 Posted August 19, 2022 Author Share Posted August 19, 2022 Manually print is not an issue. I would like to print automatically when the pdf is ready without click on pdf and send print command. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599580 Share on other sites More sharing options...
Phi11W Posted August 19, 2022 Share Posted August 19, 2022 42 minutes ago, Pearl123 said: Manually print is not an issue. I would like to print automatically when the pdf is ready without click on pdf and send print command. [Begin Architectural Sanity Check] Are you are doing this in a Web Application, accessed by remote Users, via a URL? If so, you cannot do this (not with PHP). PHP runs on your Application server and can, therefore, only print to a printer connected to your server. That's not much use to a User potentially on the other side of the planet and who has no physical access to your DataCentre, which is where the printed piece of paper would wind up! Nor can you access any printer connected to the User's computer. PHP has no knowledge of this. In short, if the User wants to print a document, then that's entirely up to them. (These days, who's to say they even have a printer!?) [End Architectural Sanity Check] Of course, if this is a "local" PHP [console] application that only needs to talk to your own printer, that's a whole other ball game - forget everything I said above. Regards, Phill W. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599582 Share on other sites More sharing options...
ginerjm Posted August 19, 2022 Share Posted August 19, 2022 As OP was told in my first response. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599583 Share on other sites More sharing options...
Pearl123 Posted August 19, 2022 Author Share Posted August 19, 2022 (edited) Yes it is local application in local Network and printer is connected with local network. Using windows if any shell command to print a pdf or html page using php Edited August 19, 2022 by Pearl123 Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599585 Share on other sites More sharing options...
ginerjm Posted August 19, 2022 Share Posted August 19, 2022 So you finally answered my original question. You are saying that the php is running on your network and NOT ON A REMOTE SERVER via the internet? Now if that is so I'm sure someone here with a little more experience using php in such a fashion may tell us how to communicate with a network device. I have never used php 'locally' myself. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599586 Share on other sites More sharing options...
Pearl123 Posted August 19, 2022 Author Share Posted August 19, 2022 I want o clear one thing that i can send the automatic print call from php with text content but i want to print pdf or html page with automatic call to printer. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599588 Share on other sites More sharing options...
Pearl123 Posted August 19, 2022 Author Share Posted August 19, 2022 I am using this library but it only print text not html https://github.com/donis/php-ipp Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599589 Share on other sites More sharing options...
ginerjm Posted August 19, 2022 Share Posted August 19, 2022 Show us this command "that i can send the automatic print call from php with text content". Show it here. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599591 Share on other sites More sharing options...
kicken Posted August 19, 2022 Share Posted August 19, 2022 You could try and find some PDF reader program that would let you print a PDF automatically. On a windows machine, you could try the official Acrobat Reader and execute it with the /p /h flags: exec("Acrobat.exe /p /h yourfile.pdf"); This is what the right click -> print option does in explorer. Quote Link to comment https://forums.phpfreaks.com/topic/315205-automatic-printing-html-created-with-php-to-network-printer/#findComment-1599593 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.