Menu

Where is the spool dir created in C# LPD?

2013-01-10
2013-04-24
  • Navpreet Singh

    Navpreet Singh - 2013-01-10

    Hi,

    I'm trying to use the C# LPD as a part of a printer emulator application. I need to put a hook for a call back event in the LPD source. I believe this will be placed at the following location in CommandReceiveJob.cs file (see the code added in bold). My question is how do I create a spool directory so that I could get the filepath?:

    /// <summary>
    /// Does the work of receiving the print job.
    /// </summary>
    /// <param name="reader">Stream reader</param>
    /// <param name="writer">Stream writer</param>
    /// <returns>PrintJob</returns>
    private PrintJob receivePrintJob(StreamReader reader, StreamWriter writer)
    {
    PrintJob printJob = null;
    ControlFile controlFile = null;
    DataFile dataFile = null;

    try
    {
    NetUtil netUtil = new NetUtil();
    byte receiveInput = null;
    IList cmd = null;

    //Reads control file or data file, which ever that arrives first
    for (int i = 1; i <= 2; i++)
    {
    receiveInput = netUtil.readNextInput(reader, writer);
    cmd = ByteUtil.parseCommand(receiveInput);
    if (receiveInput == 2)
    {
    controlFile = setControlFile(reader, writer, cmd);
    }
    else if (receiveInput == 3)
    {
    dataFile = setDataFile(reader, writer, cmd);
    }
    }
    }
    catch (Exception e)
    {
    log.Error("Problems reading Input", e);
    }

    if (null != controlFile && null != dataFile)
    {
    printJob = new PrintJob(controlFile, dataFile);
                    **String ipaddress = printJob.DataFile.HostName;
                    long actualSize = long.Parse(printJob.DataFile.Size);
                    string filepath = printJob.DataFile.
                    JobRxEvent(ipaddress, actualSize, filepath);
    }

    return printJob;
    }**

     
  • Navpreet Singh

    Navpreet Singh - 2013-01-10

    Also, I'd like to know how to setup the correct hooks from an external C# .NET windows application for starting the LPD service and then putting the call back mechanism for receiving the job when a new job is sent to the LPD service?

     

Log in to post a comment.