Question

I have developed a solution where a PL/SQL Oracle API generates the file name of a PDF (inc. full file path) that requires printing (parameter 1) and then using the DBMS_SCHEDULER passes both that file name and a printer name (parameter 2) to the following batch file:

    "C:\Program Files (x86)\Adobe\Acrobat 4.0\Reader\AcroRd32.exe" /t %1 %2

However there are occurrences where the file name passed to the batch file does not exist. Because the file does not exist Adobe continues to run (in background). This stops the API from executing again, until someone ends the windows process manually, as the DBMS job is connected to the Adobe instance.

Unfortunately (unless there is a way in Oracle to check if the file exists in the directory) I cannot work around this issue on the Oracle side, therefore I need to tackle it on the Windows side.

Therefore is there any additional logic that I can add to the batch file or any other script that will validate the existence of the file and if the file does not exist then end the process. The solution must be efficient as the printing of the PDF files is time sensitive.

If anyone does have an Oracle side solution for this issue then I will happily supply the relevant code.

Thanks in advance.

Was it helpful?

Solution

Not launching Acrobat is easier than trying to close it. You can just check for the file existence in the batch file using the IF EXIST command:

@IF EXIST %1 (
    "C:\Program Files (x86)\Adobe\Acrobat 4.0\Reader\AcroRd32.exe" /t %1 %2
) ELSE (
    REM optionally report error?
)

There are ways to check for the file from Oracle, but this is probably simpler since you already have a batch file, unless you want to test and report the error earlier in the process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top