Print directly to TCP/IP printer port

Posted on 2006-04-19
Last Modified: 2012-06-21
Does anyone know how to raw print directly to a network tcp/ip printer port (i mean like IP_192.168.0.100)? I know the winspool.writeprinter method and it seems that does not work for printers connected via tcp/ip port. Also tried with the windows.escape method and the PASSTHROUGH param but it sends jobs containing just formfeeds without any text.
My problem is that i need to send some escape codes directly to the printer (for text compression) so i must write directly to it. It works fine with a local printer.
Question by:Ferruccio Accalai
    LVL 2

    Expert Comment


    Can't you use some networking components or sockets to do the job?

    tcpclient1.Sendln(); tcpclient1 == TTcpClient.

    LVL 22

    Author Comment

    by:Ferruccio Accalai
    As you can guess i need to print to whatever printer without knowing its port til the job start, so a specified tcp component isn't the right solution, but tnx anyway
    LVL 17

    Expert Comment

    hmm, if i telnet (my printer) I can then see a list of access methods by typeing ?
    maybe yours does the same
    I can actually just FTP into it, and "Put <file>" to print
    ports open are
    IPP 631,
    FTP 20, 21
    LDP 515
    9100 9100
    don't know if any of this is of use to you, but I sure get a lot of info when I telnet into it
    LVL 17

    Accepted Solution

    In fact if I do the following
    telnet 9100
    then type
    and then close the telnet session
    the printer prints "hello", so it looks like just using a TCP component _may_ do what you want :-)
    LVL 2

    Assisted Solution

    Just as I suggested above...

    As I see it u have a few choices...
    use Indy - TCP or Telnet components
    or use sockets - built it yourself components
    or use shell commands to telnet in and print.

    Best Regards

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now