CodeIgniter Forums
Print file on server - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Print file on server (/showthread.php?tid=91306)



Print file on server - pippuccio76 - 07-18-2024

hi i have a view with 4 button to download 4 files . Is it possible to send file to printer (or open prompt to print) with the files ?


RE: Print file on server - InsiteFX - 07-18-2024

I found this article.

How to Print Document in PHP and JavaScript


RE: Print file on server - pippuccio76 - 07-19-2024

(07-18-2024, 09:23 PM)InsiteFX Wrote: I found this article.

How to Print Document in PHP and JavaScript

no , this symply  print page with js native function windows.print() ,  not file ...

i  must send the 4 files to the printer


RE: Print file on server - InsiteFX - 07-19-2024

Could you imagine someone taking over and just dumping to your printer?

All I can fine is this, and a addon printer web access.

Print to Zebra printer in php


RE: Print file on server - pippuccio76 - 07-21-2024

(07-19-2024, 08:33 PM)InsiteFX Wrote: Could you imagine someone taking over and just dumping to your printer?

All I can fine is this, and a addon printer web access.

Print to Zebra printer in php

i print label on zebra printer with my webapp ,this is the code : 

Code:
class StampaEtichette{

private $print_data;

    public $error='';

    public function __construct($print_data)
    {
    $this->print_data = $print_data;

    }


    public function zpl()  {

        $ip_stampante =getenv('IP_STAMPANTE');
       
        $fp = @pfsockopen($ip_stampante, 6101 ,$errno, $errstr);
       
        if(!$fp){
           
            $errore =  "$errstr ($errno)<br/>\n";

            log_message('error', 'Errore apertura socket : '.$errore);

            return $errore;
           
        }else{
           
            if(fputs($fp, $this->print_data)){
               
                fclose($fp);

                return 'stampato';
           
            }else{
           
                return 'Problemi Fput';
           
            }

           
           
        }
       
           


    }






}
 

but zpl is as text file , how can i send to printer pdf or xlsx ?


RE: Print file on server - Bosborne - 07-21-2024

(07-21-2024, 02:36 AM)pippuccio76 Wrote:
(07-19-2024, 08:33 PM)InsiteFX Wrote: Could you imagine someone taking over and just dumping to your printer?

All I can fine is this, and a addon printer web access.

Print to Zebra printer in php

i print label on zebra printer with my webapp ,this is the code : 

Code:
class StampaEtichette{

private $print_data;

    public $error='';

    public function __construct($print_data)
    {
    $this->print_data = $print_data;

    }


    public function zpl()  {

        $ip_stampante =getenv('IP_STAMPANTE');
       
        $fp = @pfsockopen($ip_stampante, 6101 ,$errno, $errstr);
       
        if(!$fp){
           
            $errore =  "$errstr ($errno)<br/>\n";

            log_message('error', 'Errore apertura socket : '.$errore);

            return $errore;
           
        }else{
           
            if(fputs($fp, $this->print_data)){
               
                fclose($fp);

                return 'stampato';
           
            }else{
           
                return 'Problemi Fput';
           
            }

           
           
        }
       
           


    }






}
 

but zpl is as text file , how can i send to printer pdf or xlsx ?

You need to somehow convert those types to a format understood by printers. Those are much more complex than the CSV format which has PHP functions.