Multiple Reports Print to PDF using PDF CREATOR

nav_devp
Member Posts: 47
Hi All,
I'm using PDF creatot to print few NAV reports back to back, problem is if I'm printing 10 reports and saving them at predefined place, actually only 6-7 files gets printed and rest are LOSS, not sure why this is happening.
I have put the code in NAV that before moving to print the next report, make sure previous report is printed and saved(using SLEEP command and FILEEXISTS). But no luck.
Has anyone come across this problem, is there any trigger in PDF CREATOR which confirms that report is printed and saved , using which I can determine when to move on to next report printing or any workaround?
Each report that I'm running can run upto 1 page to 1200 pages.
Please help.
Regards,
I'm using PDF creatot to print few NAV reports back to back, problem is if I'm printing 10 reports and saving them at predefined place, actually only 6-7 files gets printed and rest are LOSS, not sure why this is happening.
I have put the code in NAV that before moving to print the next report, make sure previous report is printed and saved(using SLEEP command and FILEEXISTS). But no luck.
Has anyone come across this problem, is there any trigger in PDF CREATOR which confirms that report is printed and saved , using which I can determine when to move on to next report printing or any workaround?
Each report that I'm running can run upto 1 page to 1200 pages.
Please help.
Regards,
0
Comments
-
hi,
it's depend on how many pages your each report printing and how much time you have assigned to sleep.0 -
I have assigned SLEEP until the FILEEXISTS is TRUE, so if I'm printing report 1->10, only 4, 6 are missing but rest 1-3, and 7-10 are printed fine.0
-
I think the fileexists = true might be the wrong approach when following scenario is true: PDFcreator first creates the file, and then updates it as it is printing the pages (like creating a .rar with winrar).
You should also check if your filenames for each report are unique.
Is it possible to have the report printed in one place, and when pdf-creator finishes, it moves it to the correct folder?0 -
I suggest in addition to use. SETSTAMP as well that will wait till PDFCreator has finished and the file can be modified.
SETSTAmp will try to change the time stamp for a file and if the file is still being written to, it will return false so you can wait till PDFCreator finishes and NAV can change the time stamp.0 -
Hi, Sorry if this is too late for you, hopefully can help others.
//You can terminate loops with a sleep using this command:
//PDFCreator.cIsConverted
//Which returns a boolean when successful.
//Regards,
Actually, found a better way:
Sample Code working on site:
Time1 := TIME;
//this ends a 1 second sleep loop when pdf creator has initialised (not finished) a file
REPEAT
SLEEP(1000);
UNTIL (((TIME - Time1) / 1000) >= tblSetup."pdf Timeout (Seconds)") OR
(PDFCreator.cIsConverted = TRUE);
//This ends a 1 second loop when the file exists
FileFound := FALSE;
REPEAT
SLEEP(1000);
IF EXISTS(PDFDirectory + PDFFileName) THEN
FileFound := TRUE;
UNTIL (((TIME - Time1) / 1000) >= tblSetup."pdf Timeout (Seconds)") OR FileFound;
IF NOT FileFound THEN
ERROR('Sorry!\The PDF convertor program failed to produce the required file %1\'+
'Within the specified timout interval',PDFDirectory + PDFFileName);
//This ends a 1 second loop when the pdf printer buffer is lowered by 1
PrintJobs := PDFCreator.cCountOfPrintjobs;
i := 0;
REPEAT
SLEEP(1000);
i += 1;
UNTIL (i >= tblPurchSetup."pdf Timeout (Seconds)") OR (PDFCreator.cCountOfPrintjobs < PrintJobs);
IF NOT EXISTS(PDFDirectory + PDFFileName) THEN
ERROR('Sorry!\The PDF file creation program has failed within the timeout of %1 seconds',
tblPurchSetup."pdf Timeout (Seconds)");0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions