wait until report finished printing

hi! is there i way how i can stop execution of my navision code until a report has been physically printed out. on post report is executed after the report has been gererated, but i need to execute code after the printer driver has finished printing the document. i tried with CONFIRM, but that also stops the printing of the document.

I see no other solution but querying the printer driver using some windows API calls. You will not want to do this in C/AL directly [;)]

Even if you use API calls you can not derive whether the job is physically printed or not ! You would need a sign from the printer to check that and i don’t kwon any printer that will do this. I think you need an other solution for your problem.

By the way, why would any user in his right mind want to wait for a print job to finish before being able to continue to work? Perhaps she is printing to a network printer, and there are 43523456 jobs before hers waiting in the print queue… [}:)]

Hi Jan,

quote:


By the way, why would any user in his right mind want


ideal users ? [:D][}:)]

quote:


to wait for a print job to finish before being able to continue to work? Perhaps she


SHE can work [:o)][:0]

quote:


is printing to a network printer, and there are 43523456 jobs before hers


She never waits … she’s making coffee[:D][:D]

quote:


waiting in the print queue…


This should be possible if you print directly to the printer, and turn off the print queue

Just a thought (never done it but I guess it could work) : 1/ Print the report into a .PRN file 2/ Redirect your .PRN file to the printer if you’ve to 3/ Delete or Archive the .PRN (ie: PostedInvoice500549.PRN) file

You can write your own automation server to check the printers status. In C/Side: Status := NavExtend.NavGetPrinterStatus(PrinterName,ComputerName); In VB: Public Function NavGetPrinterStatus(PrinterName As Variant, ComputerName As Variant) As Integer Dim WMI As Object Dim objWMIService As Object Dim wmiQ As Variant Dim colPrinters As Object Dim objPrinter As Object Set WMI = GetObject(“winmgmts:”) Set objWMIService = GetObject(“winmgmts:{impersonationLevel=impersonate}!\” & ComputerName & “\root\cimv2”) wmiQ = “select * from Win32_Printer where Name =’” & PrinterName & “’” Set colPrinters = objWMIService.ExecQuery(wmiQ) For Each objPrinter In colPrinters '-- Check printing status of the printer WSHGetPrinterStatus = objPrinter.PrinterStatus Next 'Case 1 = “Angehalten/Offline/Fehler” 'Case 2 = “Offline, Queue not empty” 'Case 3 = “Status Idle” 'Case 4 = “Status Printing” 'Case 5 = “Status Warming Up” 'Case else = “unbekannt” End Function

mkey. my problem was much more simple: CodeBefore(); Report.RUNMODAL; CodeAfter(); thats all i need. i tried OnPostReport, but it does not work since i need the user to make some input AFTER the report has been completely sent to the printer. i dont care what the printer does or does not. and if i use OnPostReport, the report is not sent to the printer until the user has made his input, but the input must be made after the report is sent. i just dont wanted to modify external code, and keep it all inside my report, but i guess thats not possible. servus.

You are right, you can’t do this coding inside the Report. You have to create some object like a report or a codeunit which calls the report with REPORT.RUNMODAL. The code inside this object after this command will not be continued until the report has been sent to the windows printer handler, so this is the only place to put your code into. Alex