Saving as Pdf using bullzip pdf creator.

imclever1205
Member Posts: 94
Hi All,
I have to save a report as a PDf using Bullzip creator but I am having an error,it says
"The operating system cannot find the path I specified,but still the pdf is saved correctly at the location.
So i tried to solve it by adding this code,using bullzip pdfutil,
"bz.WaitForFile(FileName, 60000);" but now I get an error message that the automation variable has to be instantiated. Can anyone please help me out?
Here is the code I wrote:
PaySetUp.GET;
PostedPayHdr.RESET;
PostedPayHdr.SETRANGE(PostedPayHdr."Pay Code",PayCodeGlobal);
IF PostedPayHdr.FINDSET THEN BEGIN
REPEAT
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(FALSE);
FileDirectory := PaySetUp."Intermediate path to save PDF";
FileName := PostedPayHdr."Pay Code" + '-' + PostedPayHdr."Employee No."+'.pdf';
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.SetValue('Output',FileDirectory +FileName );
BullZipPDF.WriteSettings(TRUE);
PaySlipRep.GetRepFilters(PostedPayHdr."Pay Code",PostedPayHdr."Employee No.");
PaySlipRep.USEREQUESTFORM(FALSE);
PaySlipRep.RUN;
//Wait for the status file to appear. This means that the print has finished
// bz.DefaultPrinterName('BullZipPDF');
bz.WaitForFile(FileName, 60000);
PostedPayHdr."PDF File".IMPORT(FileDirectory+FileName );
PostedPayHdr.MODIFY;
PaySlipStaging.RESET;
IF PaySlipStaging.FINDLAST THEN
EntryNoVar := PaySlipStaging.EntryNo + 1
ELSE
EntryNoVar := 1;
PaySlipStaging.INIT;
PaySlipStaging.EntryNo := EntryNoVar ;
PaySlipStaging.EmployeeNo := PostedPayHdr."Employee No.";
PaySlipStaging.DocumentBinary := PostedPayHdr."PDF File";
PaySlipStaging.FileName := PostedPayHdr."Pay Code" + '-' + PostedPayHdr."Employee No.";
PaySlipStaging.MimeType := '.pdf';
PaySlipStaging.StartDate := PostedPayHdr."Starting Date";
PaySlipStaging.EndDate := PostedPayHdr."End Date";
PaySlipStaging.EmployeeObjectID += 1;
PaySlipStaging.Imported := 0;
PaySlipStaging.NotImportedReason := '';
PaySlipStaging.DateAdded := TODAY;
PaySlipStaging."Pay Code":=PostedPayHdr."Pay Code";
PaySlipStaging.INSERT;
ERASE(FileDirectory +FileName);
UNTIL PostedPayHdr.NEXT =0;
END;
PayPerLines.RESET;
PayPerLines.SETRANGE(PayPerLines."Pay Code",PayCodeGlobal);
PayPerLines.MODIFYALL(PayPerLines."Payslip Generated",TRUE);
I have to save a report as a PDf using Bullzip creator but I am having an error,it says
"The operating system cannot find the path I specified,but still the pdf is saved correctly at the location.
So i tried to solve it by adding this code,using bullzip pdfutil,
"bz.WaitForFile(FileName, 60000);" but now I get an error message that the automation variable has to be instantiated. Can anyone please help me out?
Here is the code I wrote:
PaySetUp.GET;
PostedPayHdr.RESET;
PostedPayHdr.SETRANGE(PostedPayHdr."Pay Code",PayCodeGlobal);
IF PostedPayHdr.FINDSET THEN BEGIN
REPEAT
IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(FALSE);
FileDirectory := PaySetUp."Intermediate path to save PDF";
FileName := PostedPayHdr."Pay Code" + '-' + PostedPayHdr."Employee No."+'.pdf';
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.SetValue('Output',FileDirectory +FileName );
BullZipPDF.WriteSettings(TRUE);
PaySlipRep.GetRepFilters(PostedPayHdr."Pay Code",PostedPayHdr."Employee No.");
PaySlipRep.USEREQUESTFORM(FALSE);
PaySlipRep.RUN;
//Wait for the status file to appear. This means that the print has finished
// bz.DefaultPrinterName('BullZipPDF');
bz.WaitForFile(FileName, 60000);
PostedPayHdr."PDF File".IMPORT(FileDirectory+FileName );
PostedPayHdr.MODIFY;
PaySlipStaging.RESET;
IF PaySlipStaging.FINDLAST THEN
EntryNoVar := PaySlipStaging.EntryNo + 1
ELSE
EntryNoVar := 1;
PaySlipStaging.INIT;
PaySlipStaging.EntryNo := EntryNoVar ;
PaySlipStaging.EmployeeNo := PostedPayHdr."Employee No.";
PaySlipStaging.DocumentBinary := PostedPayHdr."PDF File";
PaySlipStaging.FileName := PostedPayHdr."Pay Code" + '-' + PostedPayHdr."Employee No.";
PaySlipStaging.MimeType := '.pdf';
PaySlipStaging.StartDate := PostedPayHdr."Starting Date";
PaySlipStaging.EndDate := PostedPayHdr."End Date";
PaySlipStaging.EmployeeObjectID += 1;
PaySlipStaging.Imported := 0;
PaySlipStaging.NotImportedReason := '';
PaySlipStaging.DateAdded := TODAY;
PaySlipStaging."Pay Code":=PostedPayHdr."Pay Code";
PaySlipStaging.INSERT;
ERASE(FileDirectory +FileName);
UNTIL PostedPayHdr.NEXT =0;
END;
PayPerLines.RESET;
PayPerLines.SETRANGE(PayPerLines."Pay Code",PayCodeGlobal);
PayPerLines.MODIFYALL(PayPerLines."Payslip Generated",TRUE);
0
Comments
-
What is the datatype of BZ?
Did you try by replacing bz with BullZipPDF?0 -
Name DataType Length Subtype
bz Automation 'Bullzip - PDF Writer Automation'.ComPdfUtil
This is how I declared it and I even tried to replace bz by BullZipPDF.0 -
Regarding Initialization error, you have to initialize bz variable like
IF ISCLEAR(bz) THEN CREATE(bz);
0 -
I tried the code you suggested,it saves the pdf fine but still it gives the the first error message again saying that cannot find the specified path. ](*,)0
-
Please read this thread How to save Navision Reports as PDF. On page 6 you find the BullZip code. Blog entry: http://mibuso.com/blogs/ara3n/2008/08/0 ... ts-to-pdf/
He uses this code to check if the file exists:TimeOut := 0; WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN SLEEP(1000); TimeOut := TimeOut + 1; END;
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)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