System Deletes NAS Created PDF File

mjopatrnymjopatrny Member Posts: 19
I have a report that I am running through NAS that will create a PDF file in a specified directory. When I run the report interactively, it works. In the Event Viewer, I get the following messages:

Event Type: Information
Event Source: Print
Event Category: None
Event ID: 10
Date: 5/10/2011
Time: 12:58:56 PM
User: HEATHCO\SVC_NAVNAS_CA
Computer: TR-AP-01T
Description:
Document 3, Dollar Report - Item Category2 owned by SVC_NAVNAS_CA was printed on Bullzip PDF Printer via port BULLZIP. Size in bytes: 56712; pages printed: 2


Which is immediately followed by

Event Type: Information
Event Source: Print
Event Category: None
Event ID: 13
Date: 5/10/2011
Time: 12:58:56 PM
User: NT AUTHORITY\SYSTEM
Computer: TR-AP-01T
Description:
Document 3, Dollar Report - Item Category2 owned by SVC_NAVNAS_CA was deleted on Bullzip PDF Printer.


The entire process is designed to create a PDF and then e-mail the file to a list of recipients. What is odd is that the process deleting the file is kicked off by the SYSTEM account so there is some trigger event that's causing this to happen.

Couple of observations:

1) If I run the process interactively, the file is created in the specified folder and e-mailed. If I leave the file, the NAS process will attempt to create a new file which gets deleted but it will e-mail the existing file. This tells me that the NAS has permissions to read this folder.
2) The NAS service has been given full domain prvilieges
3) The process fails on both a local drive and network drive
4) Verified that I can log on to the server under the NAS account and perform file transactions (create, delete, etc.) on the folders in observation (3)
5) NAS is used to print files to standard printers
6) Microsoft had posted a fix (http://support.microsoft.com/kb/909906) for a similar problem that was occuring on Windows 2003 SP1 Servers, but we are at SP2 so the patch has been applied.

What I can't figure out is why the document is getting deleted immediately after it is created. The run-time properties for BullZip are as follows. I've tried a few different setups, but nothing seemed to make a difference:

IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
FileName := JobQueueSetup."Output Directory" + FileName + ' (' + FORMAT(Month) + '-' + FORMAT(Day) + '-' + FORMAT(Year) + ').pdf';
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileName);
BullZipPDF.SetValue('Showsettings', 'never');
BullZipPDF.SetValue('ShowPDF', 'no');
BullZipPDF.SetValue('ShowProgress', 'no');
BullZipPDF.SetValue('ShowProgressFinished', 'no');
BullZipPDF.SetValue('SuppressErrors', 'yes');
BullZipPDF.SetValue('ConfirmOverwrite', 'no');
BullZipPDF.WriteSettings(TRUE);


Any ideas or suggestions?
Mike Opatrny

Answers

  • ara3nara3n Member Posts: 9,256
    Did you try and delete the existing file if it exists with nav code before calling pdf printing tool?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mjopatrnymjopatrny Member Posts: 19
    I didn't do anything explicitly to delete the existing file, but it was not an issue when I ran the report interactively and the NAS run fails even when the destination folder is empty.
    Mike Opatrny
  • ara3nara3n Member Posts: 9,256
    I would add some code, and see if it resolves the issue.

    if exists(filelocation) then
    erase(filelocation);


    Also add some code to make the file name unique. For example add OrderNo or CustomerNo to the file name, so that it doesn't pick up the wrong file.


    You would have to change the code for if exists then erase to loop through virtual file table and find any pdf files and delete them all.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • mjopatrnymjopatrny Member Posts: 19
    Solved! The "Keep Printed Documents" box needed to be checked on the BullZip printer properties tied to the NAS account.
    Mike Opatrny
Sign In or Register to comment.