Peper Posted November 16, 2017 Share Posted November 16, 2017 Hello everyone So i assume many shop owners prints a lot of different papers like packing slips, barcodes, waybills and and So my question is there a way to specify which printer to use by default depending on filename or form or page size. So instead of the popup window when ctl p or print button is pressed, no input needed to select correct printer and fiddles - automates. Not silent printing Even if in the admin side viewing document first, any way to list available printers locally and on shared network using html, show available printers or rather specific - select printer - mouse click and print. Please post if you know something in this line, there was some PHP functions but seems that was deprecated and dropped entirely. Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
MrPhil Posted November 17, 2017 Share Posted November 17, 2017 I don't think I've ever seen an application that went directly to the printer when I pressed the Print button, without a dialog asking for the printer to be used, and its settings. That includes word processors, browsers, mail clients, and PDF readers. They use OS/windowing services to select the printer. About the best you could probably do is to write the output to a temporary file, and then under the covers, batch submit it (via command line) to a printer. You might, under your OS, be able to associate custom printer names for different paper trays and modes on one printer, as well as for physically separate printers. Or, the command could specify the paper tray, landscape/portrait, etc. Would it be adequate to still have a print dialog, but have everything prefilled/preselected based on which queue you sent to? Is that what you're asking for? That gives you a chance to recover if the printer went down, ran out of paper or ink, or otherwise had problems. Then it's normally just one "go ahead and print the thing" button click. Your OS might have a print dialog that you could invoke from your store application, along with pre-setting all the choices. It might even have the ability to accept the file on a socket or pipe, so that you don't have to write a file first. Naturally, all this is going to be very OS-dependent, but it might be possible to put some hooks into osC to help with the process. Just some random thoughts... I'd like to hear the thoughts of others (I'll take off my tinfoil hat, first!). Link to comment Share on other sites More sharing options...
ArtcoInc Posted November 17, 2017 Share Posted November 17, 2017 @Peper A quick Google search came up with these. Do any of these help? http://docs.php.net/manual/da/function.printer-set-option.php http://php.net/manual/fa/function.printer-set-option.php However, as @MrPhil mentioned, you are administering your store through a Browser, and all printing functions *should* be handled by your browser, and/or by the OS on your workstation. Most 'properly coded' software hands off the printing functions to the local OS (although, Micro$oft is notorious for bypassing its own rules in cases like this). Malcolm Link to comment Share on other sites More sharing options...
Dan Cole Posted November 18, 2017 Share Posted November 18, 2017 Have you tried using a macro program?. Record your macro and call it from your php script. That might do it. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Peper Posted November 20, 2017 Author Share Posted November 20, 2017 While researching this, i got sidetracked <body bgcolor="chucknorris"> test </body> Will give red background and so a few similar other examples Did not know that! Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Dan Cole Posted November 20, 2017 Share Posted November 20, 2017 10 hours ago, Peper said: While researching this, i got sidetracked You sure did. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Peper Posted November 21, 2017 Author Share Posted November 21, 2017 @wHiTeHaT The printers can only print if it is printed on the same server machine as far as i could find out - php_printer.dll. Also this was removed from newer versions Apache PHP Seems this cant be done or there is no easy way this will error: $handle=printer_open("EPSON LX-300"); printer_open — Opens a connection to a printer (PECL printer SVN) PHP Fatal error: Call to undefined function printer_open() in /home/---/--/----/courier_print.php on line 39 Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted November 21, 2017 Author Share Posted November 21, 2017 @wHiTeHaT As far as I understand this, the PHP code cannot do this at client side I have to install the php 5.5 version first on another pc to further test, currently running php 7.1.9 (Zend: 3.1.0) Just now busy checking and deciphering whats is needed and happening here <?php $tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file. $file = tempnam($tmpdir, 'tmp'); # nama file temporary yang akan dicetak $handle = fopen($file, 'w'); $condensed = Chr(27) . Chr(33) . Chr(4); $bold1 = Chr(27) . Chr(69); $bold0 = Chr(27) . Chr(70); $initialized = chr(27).chr(64); $condensed1 = chr(15); $condensed0 = chr(18); $Data = $initialized; $Data .= $condensed1; $Data .= "==========================\n"; $Data .= "| ".$bold1."OFIDZ MAJEZTY".$bold0." |\n"; $Data .= "==========================\n"; $Data .= "Ofidz Majezty is here\n"; $Data .= "We Love PHP Indonesia\n"; $Data .= "We Love PHP Indonesia\n"; $Data .= "We Love PHP Indonesia\n"; $Data .= "We Love PHP Indonesia\n"; $Data .= "We Love PHP Indonesia\n"; $Data .= "--------------------------\n"; fwrite($handle, $Data); fclose($handle); copy($file, "//localhost/EPSOM LX-300"); # Lakukan cetak unlink($file); ?> Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.