Running from php shell_exec

  • I don't know if this is the right place to ask this question, but I don't really know where else to try. I am trying to create a Delphi console application to print a pdf created by a php program in the background using WPViewPDF. I have copied the code in the help file to do this and when I compile and run the program it works fine from the DOS prompt. However, when I run the program through a shell_exec command from php, I can see from task manager that the program is running, but there is no printed output and the program continues to run until I terminate the process. The only difference I can see in task manager is that the from the DOS prompt the process user name is the current user, whereas from the shell_exec command the user name is SYSTEM. Can anyone help me or suggest where I might find appropriate help?

  • Following some input from a TeamB member, I have changed from a console app to windowless GIU app.

    This is the code I am using

    function PrintPdfFile : boolean;
    var
    fileName : string;
    printerName : string;
    begin
    fileName := ParamStr(1); // contains name of pdf file
    printerName := 'PRINTER=' + ParamStr(2); // contains name of printer
    pdfPrint(PChar(fileName), PChar('') ,PChar(****), PChar('****'), nnn, PChar(printerName));
    Result := True;
    end;

    This works on my XP PC to a point.
    However I have 2 printers called HP LaserJet 5 and HP LaserJet 5000 Series PCL. If I send a print to the LJ5, it prints on the LJ5000. If I send a print to the LJ5000, it prints on the LJ5000. Prints sent to a printer called Sales Laser print as required.

    I then tried to run the program on a customer's W2000 server PC. This runs the program, but I get no output to any printer, no matter which printer I direct the output to.