How to check a File is closed and ready to rename
John
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?
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?
0
Comments
-
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.0 -
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).0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions