[ic] lpr within a usertag

Grant emailgrant at gmail.com
Fri Feb 1 20:18:12 EST 2008

> > I'm able to print from my remote IC machine to my local printer server
> > with 'lpr file.pdf' but I'm having trouble making it work within an IC
> > usertag.  I'm using the following to test it:
> >
> > Usertag print Order
> > Usertag print Routine <<EOR
> > sub {
> >         'lpr /catalogpath/file.pdf';
> > }
> > EOR
> >
> > I've also tried specifying just file.pdf without the absolute path but
> > neither works.  There is nothing in either error.log.  Does anyone see
> > what's wrong here?
> >
> You used single quotes instead of backticks.  Your UserTag will have
> returned the string verbatim, with no errors in the logs, as it will
> have done exactly as you asked (return a scalar value).

Great, that's working now.  Thank you Peter and Kevin.

> You should use system() instead of backticks for readability, and to
> help avoid this sort of problem.

Is that:

system(lpr file.pdf);

I couldn't get that to work.

> Note that you'll only be able call out like this from within a global
> UserTag.  Note also that you should always specify the full path to
> executables to avoid $PATH-related problems and attacks.

Changed to '/usr/bin/lpr'.

> You should consider using email instead of paper.  Emails are far more
> convenient to forward, archive and search, and you can always print

I'm setting up functionality to allow me to print shipping labels and
order receipts on my local printer from IC on my remote machine.  Does
what you're saying apply to that scenario?

> them if you really need to.  Exposing a LPD port to the world doesn't
> strike me as such as good idea either.

Fewer open ports are better, of course, but we've got to communicate
too, right?  How would you set this up?

- Grant

More information about the interchange-users mailing list