IF ISCLEAR(PDFCreator) THEN CREATE(PDFCreator); IF ISCLEAR(PDFCreatorError) THEN CREATE(PDFCreatorError); IF CreatePDF.FIND('-') THEN BEGIN REPEAT ReportName := CreatePDF."Report Name"; Object.SETFILTER(Object.Type, '%1', Object.Type::Report); Object.SETFILTER(Object.Name, ReportName); Object.FIND('-'); ReportID := Object.ID; IF Object.GET(Object.Type::Report,'',ReportID) THEN; FileDirectory := 'J:\PLM\'; FileName := ReportName +'.pdf'; PDFCreatorError := PDFCreator.cError; IF PDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN ERROR('Status: Error[' + FORMAT(PDFCreatorError.Number) + ']: ' + PDFCreatorError.Description); // Window.OPEN('processing'); // WindowisOpen := TRUE; IF FileName = '' THEN ERROR('Please specify what the file should be saved as'); Object.GET(Object.Type::Report,'',ReportID); PDFCreatorOption := PDFCreator.cOptions; PDFCreatorOption.UseAutosave := 1; PDFCreatorOption.UseAutosaveDirectory := 1; PDFCreatorOption.AutosaveDirectory := FileDirectory; PDFCreatorOption.AutosaveFormat := 0; //PDF file, you can also save in other formats PDFCreatorOption.AutosaveFilename := FileName; PDFCreator.cOptions := PDFCreatorOption; PDFCreator.cClearCache(); DefaultPrinter := PDFCreator.cDefaultPrinter; PDFCreator.cDefaultPrinter := 'PDFCreator'; PDFCreator.cPrinterStop := FALSE; IF FILE.EXISTS('J:\PLM\FileName') THEN FILE.ERASE('J:\PLM\FileName'); REPORT.RUNMODAL(ReportID,FALSE,TRUE); // Window.CLOSE; SLEEP(30000); Subject := FileName; Body := 'Please find the enclosed copy of "' + ReportName + '" report.'; SMTPMail.CreateMessage(SenderName,SenderAddress, CreatePDF."E-Mail", Subject , Body, TRUE ); SMTPMail.AddAttachment('J:\PLM\' + FileName); SMTPMail.Send(); UNTIL CreatePDF.NEXT =0; END; CLEAR(PDFCreator); CLEAR(PDFCreatorOption); CLEAR(PDFCreatorError);
Answers
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
I tried looking for it...i couldnt find anything
In the mean time I tried doing this:
I wrote that code after Report.runmodal(ReportID,FALSE,TRUE);
AND
before Subject :=FileName;
Some of the files that the users generate are like 1000+ pages, so this wont work in that case. ](*,)
anyone else had this issue, regarding the Auto-Save Mode error. The PDFCreator Version I am using is 1.5.1.
I also tried this line of code after the report.runmodal (my efforts were futile, it still gave me the auto-save error):