Options

How to check a File is closed and ready to rename

JohnJohn Member Posts: 43
I’m using PDF995 to write output to a PDF files with a fixed name.
In the printer settings I choose for ‘Write directly to printer’ to avoid queuing.
After writing the report I want to rename the file to a filename that suits the report.
Invoice_<Customer.No.>.PDF.
The problem is that I can’t get control over when the PDF995 is finished closing the file.

I tried opening the file until it succeeds, than close it and then rename the file.
But even though I’m able to open and close the file, the rename still fails sometimes.

"Print FileName" := 'C:\PDF Document\PDFPrint.PDF'; //PDF995 Setting
RepartitieREP.RUNMODAL;
"PDF FileName" := 'C:\PDF Document\Invoice'+ FORMAT(“Customer.No.”) + '.PDF';
PDF_Ready := FALSE;
WHILE NOT PDF_Ready DO
BEGIN
IF File.OPEN("Print FileNaam") THEN BEGIN
File.CLOSE;
PDF_Ready := TRUE;
END
ELSE
SLEEP(1000); // Wait a little and try again
END;
FILE.RENAME("Print FileName","PDF FileName");

Is there any way of checking and waiting until I’m certain that I can rename the file?

Comments

  • Options
    SavatageSavatage Member Posts: 7,142
    have you tried it's brother - http://www.pdfedit995.com ?

    it has naming features;

    Autoname provides 3 options-
    a. Name and specify location of the PDF document using the "Save As" dialog (default).
    b. Automatically name the document based on the originating document and save it in the pdf995\output folder.
    c. Save all PDF documents to the same filename. When this is selected the user is prompted to specify a PDF filename. This can be helpful when pdf995 is incorporated into automated workflow systems.
  • Options
    JohnJohn Member Posts: 43
    I'm using PDF995edit to set option C.
    I'm runnung a report(a) that runs another report(b) who's output I want in PDF. About 2600 reports. To get control over the filename I have to rename it in Report(a).
Sign In or Register to comment.