Hi All,
Help me out. I am creating pdf file by using pdfcreator. Report is created but, while clicking any where in window of sales invoice. It is giving erro “‘Posted Sales Invoice’ cannot close because the system is currently working.”
Details:
Created a button on Posted Sales Invoice form to generate PDF.
On clicking the below codes are running:
IF ISCLEAR(PDFCreator) THEN
CREATE(PDFCreator);
IF ISCLEAR(PDFCreatorError) THEN
CREATE(PDFCreatorError);
FileDir := ‘C:\Mailed Invoices’;
FilNam:=DELCHR(Shpt.“No.”,’=’,’/’);
FileName := FilNam+’.pdf’;
PDFCreatorError := PDFCreator.cError;
IF PDFCreator.cStart(’/NoProcessingAtStartup’,TRUE) = FALSE THEN
ERROR(‘Status: Error[’ + FORMAT(PDFCreatorError.Number) + ']: ’ + PDFCreatorError.Description);
PDFCreatorOption := PDFCreator.cOptions;
PDFCreatorOption.UseAutosave := 1;
PDFCreatorOption.UseAutosaveDirectory := 1;
PDFCreatorOption.AutosaveDirectory := FileDir;
PDFCreatorOption.AutosaveFormat := 0;
PDFCreatorOption.AutosaveFilename := FileName;
PDFCreator.cOptions := PDFCreatorOption;
PDFCreator.cClearCache();
DefaultPrinter := PDFCreator.cDefaultPrinter;
PDFCreator.cDefaultPrinter := ‘PDFCreator’;
PDFCreator.cPrinterStop := FALSE;
SIH.RESET;
SIH.SETRANGE(“No.”,Shpt.“No.”);
IF SIH.FIND(’-’) THEN
REPORT.RUNMODAL(REPORT::“Sales Invoice”,FALSE,FALSE,SIH);
SLEEP(1500);
PDFCreator.cPrinterStop := TRUE;
PDFCreator.cDefaultPrinter := DefaultPrinter;
PDFCreator.cClose;
CLEAR(PDFCreator);
What would be the resolution. Am I missing something?