Either NextReports or ABPDFBox is holding the file open. I can't delete the files when the app is running.
When the app is terminated, the files can be deleted.
When the app is terminated, the files can be deleted.
B4X:
Dim PDF As ABPDFBox
PDF.Initialize("mysecretdonationkey" )
Try
'Run the report and export the output report file
repexec.reportPrepAndRun(inputlist) ' generates the report and writes to disk
Log(" file: "&dir&"\"&fname)
Catch
LogDebug("Error: Loading Reports : " & LastException.Message)
End Try
Sleep(3000)
If File.Exists(pdfFolder,fn&".pdf") Then
If fprinter <> "" Then ' if a printer has been assigned - print te report
PDF.Print ( pdfFolder, fn&".pdf", fprinter, 1, True)
Sleep(1000)
Else
Log(" _____----______ No Printer defined")
End If
Else
Log(" File PDF not found: "&fn&".pdf")
End If
UpdatePrinted
If fprinter <> "" Then ' if a printer is assigned, delete the file....
Sleep(5000)
DelPDF( fn&".pdf")
End If
End Sub
Sub DelPDF( pdffile As String)
If File.Exists(pdfFolder,pdffile) Then
Dim del As Boolean = File.Delete(pdfFolder, pdffile)
If del Then
Log(" DELETED File PDF -: "&pdffile)
Else
Log(" File was NOT DELETED PDF -: "&pdffile) ' this is returned - files are locked and can't be deleted.
End If
Else
Log(" Can not delete File PDF - not found: "&pdffile)
End If
End Sub
Last edited: