Announcement

Collapse
No announcement yet.

calling irfanview /print from php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Solved calling irfanview /print from php

    I have a php script which needs to give a print command to two different networkprinters.
    I use IrfanView's /print="\\\ipadress\printername1" and /print="\\\ipadress\printername2" in the script. But it doesnt execute at all.

    The program lines which handles this command looks like this:
    PHP Code:
    $file "c:\somejpg.jpg";
    exec'"c:\Program Files\IrfanView\i_view32.exe" '.$file.' /print="\\\ipadress\printername2"' ); 
    PHP Code:
    exec'"c:\Program Files\IrfanView\i_view32.exe" '.$file.' /print'); 
    This works, but only the default printer. I want to add the name.

    #2
    Try this:
    Code:
    $file = "c:\somejpg.jpg";
    exec( '"c:\Program Files\IrfanView\i_view32.exe" '.$file.' /print="\\\\ipadress\\printername2"' );
    As far as I know every backslash has to be called using the escape sequence for it, which is "\\", so if you like to have one backslash, you will need "\\", if you have a dobule backslahs, you need four of them: "\\\\"...

    Comment


      #3
      thanks

      i thought i tried all different possibilities; with escape sequences or without. Trying some things at home now and it works like a charm now. Seems that i mess some stuff up with creating a string with single quotes.
      Creating it with the normal quotes and escape sequences works much better.
      It looks like this now:

      PHP Code:
      $file "c:\program files\wolk.jpg";
      $cmd "\"c:\program files\irfanview\i_view32.exe\" ".$file." /print=\"hp deskjet 3320 series\"";
      exec$cmd ); 
      i only have to escape the quotes and not the slashes; hopefully it works on network printer and adress behind /print=... as well.

      Comment

      Working...
      X