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);
0
Comments
Did you try by replacing bz with BullZipPDF?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
bz Automation 'Bullzip - PDF Writer Automation'.ComPdfUtil
This is how I declared it and I even tried to replace bz by BullZipPDF.
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
He uses this code to check if the file exists: