1

I develop a web based label print application. So Now need to print this automatic without browser print preview. so how can I do this with php direct print...

4
  • Possible duplicate of javascript print without print dialog box Commented Sep 24, 2018 at 6:00
  • You should you Javascript for this action Commented Sep 24, 2018 at 6:32
  • Ok, have you tried anything to solve your problem? Can we see your code? Or do you expect others to code this for you? Commented Sep 24, 2018 at 6:41
  • Current time I implement this with javascript print system with kiosk-printing. so now browser print preview show for just 1 second and take some time to start print. but my client want to direct silent print . I develop my application with php. So how is possible to print direct with php? I think you understand my problem Kerbholz suman Dey and mulquin Commented Sep 24, 2018 at 9:33

4 Answers 4

1

PHP is server side language can't access to client OS drivers (such as printer and etc)

, Also you can access & request to run PHP file scripts only from browser by domain or use cron job(cron is a Linux utility which schedules a command or script on your server to run automatically), you can't access to client system and use printer driver, but, for this you must use APP that installed on client OS,
or automatically run a js script, if client OS is linux: use cron job , if client OS is windows: use Cron Task or Scheduled Tasks

Sign up to request clarification or add additional context in comments.

Comments

1

you can print directly to any printer using PHP. I am using PHP for printing.

you can use mike42 escpos github plugin.

after download you need to make a connector for your printer. use this

after you can print. my sample for a shared printer and for a php file that is running by schedule task is:

require 'vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\CapabilityProfile;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;


$connector = new WindowsPrintConnector("smb://computername/printername");
$printer = new Printer($connector);

$printer -> text("hello world");
$printer -> text("\n");
$printer -> text("\n");
$printer -> text("hello again");
$printer -> cut();
$printer -> close();

Comments

0

you can use webclient for php refference link https://www.neodynamic.com/products/printing/raw-data/php/ i think this is what you want

Comments

0

If you are using chrome, right click the shortcut icon, edit the target and add --kiosk-printing , it does the magic

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.