Printing under Windows 
Author Message
 Printing under Windows

I'd like to print the contents of a Tk canvas under Microsoft Windows.

Under Unix I use

  exec [.c postscript -rotate 1] | lpr

but I guess there is no such thing as  lpr  under Windows.

Any ideas?

Thank you in advance,
Andre'

--



Fri, 07 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:

> I'd like to print the contents of a Tk canvas under Microsoft Windows.

EM Schwartz has released a number of indows-specific extensions,
including one for printing, at  http://www.du.edu/%7Emschwart/tcl-tk.htm

Bob
--

Mayo Foundation                                           (507) 284-2702
Rochester MN, 55905 USA   http://www.mayo.edu/sppdg/sppdg_home_page.html



Fri, 07 Mar 2003 03:00:00 GMT  
 Printing under Windows


Quote:

> > I'd like to print the contents of a Tk canvas under Microsoft Windows.

> EM Schwartz has released a number of indows-specific extensions,
> including one for printing, at  http://www.du.edu/%7Emschwart/tcl-tk.htm

So do I. Try http://pages/infinit.net and go to downloads for the TkPrint
1.1 extension.


Fri, 07 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:

> I'd like to print the contents of a Tk canvas under Microsoft Windows.

> Under Unix I use

>   exec [.c postscript -rotate 1] | lpr

> but I guess there is no such thing as  lpr  under Windows.

One item that's high on my list of Windows annoyances is that there
is no way to tell it: "PostScript file A.  PostScript printer B.
Send A to B.  Please."

Fortunately, there's a program available that helps:

    http://hem.passagen.se/ptlerup/prfile.html

It's very similar in flavor to pr and lpr, for us Unix hackers who
got dragged, kicking and screaming, into the Windows world.

For further discussion, see:

    http://purl.org/thecliff/tcl/wiki/PrintingACanvasUnderWindows




Fri, 07 Mar 2003 03:00:00 GMT  
 Printing under Windows
Hi Andre,

I tried your example under Linux SuSE6.3, but received
the message: couldn't execute "%PS-Adobe-3.0 EPSF-3.0
             creator: Tk Canvas Widget
             for:
             title:  Window .c
             BoundingBox: 296 376 316 416: file name too long

info tclversion
8.3

Question: some utilities do not exist in operating system
          or tk-version to low ?

Gru?

Vaclav

Quote:

> I'd like to print the contents of a Tk canvas under Microsoft Windows.

> Under Unix I use

>   exec [.c postscript -rotate 1] | lpr

> but I guess there is no such thing as  lpr  under Windows.

> Any ideas?

> Thank you in advance,
> Andre'

> --




Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows
[quoting corrected]

Quote:


>>   exec [.c postscript -rotate 1] | lpr
>I tried your example under Linux SuSE6.3, but received
>the message: couldn't execute "%PS-Adobe-3.0 EPSF-3.0   ...
>             ... : file name too long

Andre probably forgot something, because as it is, his line
tried to execute the whole postscript-output as a command-name which
of course cannot work.

either you do:
  set fp [open "| lpr" w]
  puts $fp [.c postscript -rotate 1]
  close $fp

or you write the postscript-output to a temp-file (/tmp/tempfilename.ps)
(see docu for postscript in canvas-manpage) and then:
  exec lpr /tmp/tempfilename.ps
you might just as well specify the external command lpr in some way
to the canvas-postscript subcommand.



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows
The link should be http://pages.infinit.net/cclients



Quote:




> > > I'd like to print the contents of a Tk canvas under Microsoft Windows.

> > EM Schwartz has released a number of indows-specific extensions,
> > including one for printing, at  http://www.du.edu/%7Emschwart/tcl-tk.htm

> So do I. Try http://pages/infinit.net and go to downloads for the TkPrint
> 1.1 extension.



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:

> One item that's high on my list of Windows annoyances is that there
> is no way to tell it: "PostScript file A.  PostScript printer B.
> Send A to B.  Please."

What's wrong with the print command?  Works fine for me on NT4.  And
than there is also copy.

--
ISION Internet AG
Benjamin Riefenstahl

Ruhrstrasse 61
D-22761 Hamburg
http://www.ision.net



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:


>>>   exec [.c postscript -rotate 1] | lpr
> Andre probably forgot something

Both of you are right of course. I currently

   exec echo [.c postscript -rotate 1] | lpr

Quote:
> either you do:
>   set fp [open "| lpr" w]
>   puts $fp [.c postscript -rotate 1]
>   close $fp

But now that we have different solutions, which one should be used?
Using temporary file might cause problems (one needs a unique filename
e.g.), my 'echo' looks a bit suspicious as well...

Andre'

--



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:

> What's wrong with the print command?  Works fine for me on NT4.  And
> than there is also copy.

I've not tried 'print' yet since I did not know of it.
I tried 'copy file.ps lpt1:' but it did not work.

Well - the printer is a network printer, and lpt1: is the raw parallel
port, isn't it?  (As you might have noticed, I am pretty clueless when it
comes to Dos/Windows, I have not used it for a couple of years now...)

Andre'

PS: Thanks for all the responses, very helpful indeed ;-)

--



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:


> > What's wrong with the print command?  Works fine for me on NT4.  And
> > than there is also copy.

> I've not tried 'print' yet since I did not know of it.
> I tried 'copy file.ps lpt1:' but it did not work.

> Well - the printer is a network printer, and lpt1: is the raw parallel
> port, isn't it?  (As you might have noticed, I am pretty clueless when it
> comes to Dos/Windows, I have not used it for a couple of years now...)

> Andre'

> PS: Thanks for all the responses, very helpful indeed ;-)

> --


Here is some code that I used to use to print
cross platform to a printer named 2a on a machine
named 'hobbes'.  All the unix machines had lpr
installed on them..

    if {[string compare $tcl_platform(platform) windows]} {
        exec {net use lpt1 \\hobbes\2a}
        set printFile [open "lpt1" w]
    } else {
        set printFile [open "| lpr -P2a" w]
    }

    # Write data to 'printFile'
    puts $printFile "data"
    close $printFile

I hope that helps.

--Dan



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows

Quote:

> I tried 'copy file.ps lpt1:' but it did not work.
> Well - the printer is a network printer, and lpt1: is the raw parallel
> port, isn't it?

In this case, try
copy file.ps \\machine\sharedPrinterName

It should work, if you make sure the .ps file has the %! header at the
start, or whatever magic string postscript uses.

--
Darren New / Senior MTS & Free Radical / Invisible Worlds Inc.
San Diego, CA, USA (PST).  Cryptokeys on demand.
"No wonder it tastes funny.
            I forgot to put the mint sauce on the tentacles."



Sat, 08 Mar 2003 03:00:00 GMT  
 Printing under Windows


Quote:
>either you do:
>  set fp [open "| lpr" w]
>  puts $fp [.c postscript -rotate 1]
>  close $fp
>or you write the postscript-output to a temp-file (/tmp/tempfilename.ps)
>(see docu for postscript in canvas-manpage) and then:
>  exec lpr /tmp/tempfilename.ps

Why make life awkward for yourself?  The easiest technique is:
   exec lpr <<[.c postscript -rotate 1]

Mind you, when I'm actually implementing this sort of thing in real
applications I do something more sophisticated so as users can specify
the printing command (useful for doing 2-up printing or directing to a
different printer) without needing to understand Tcl's restrictions in
the area of [exec].

   # This is just an illustration.  Really get it from a dialog...
   set printingCommand lpr

   exec sh -c $printingCommand <<[.c postscript -rotate 1] \

Donal.
--
Donal K. Fellows (at home)
--
FOOLED you!  Absorb EGO SHATTERING impulse rays, polyester poltroon!!
      (WARNING: There is precisely one error in this message.)



Wed, 12 Mar 2003 03:00:00 GMT  
 
 [ 13 post ] 

 Relevant Pages 

1. Problem with printing on Windows

2. Printing In Windows

3. Host printing in Windows

4. printing in Windows

5. printing under windows

6. Printing in windows

7. Problem with Printing In Windows for VisualWorks 2.0

8. Speed up printing in windows

9. Printing in Windows 98

10. Clipper/DOS Print in Windows 2000?

11. problem printing using Windows XP in network

12. CDD 3009 app printing under Windows 95

 

 
Powered by phpBB® Forum Software