if ((pageEnd == 0) || (pageEnd < pageStart)) { using (Document pdfInfo = new Document(OriginalFile)) { pageEnd = pdfInfo.Pages.Count; } } PdfFileEditor pdfEditor = new PdfFileEditor(); pdfEditor.Extract(OriginalFile, pageStart, pageEnd, documentPath);if (!IncludeBarcodePage)
{
using (Document pdfDocument = new Document(documentPath))
{
// we will be extracting out our document to then remove the cover page
pdfEditor.CloseConcatenatedStreams = true;
pdfEditor.Delete(documentPath, barcodePage, NewFilePath);
pdfEditor = null;
}<span style="color:green;">// Do the delete</span> <span style="color:blue;">try</span> { <span style="color:#2b91af;">File</span>.Delete(documentPath); _logger.DebugFormat(<span style="color:#a31515;">"Sucessfully deletes Pre Processing file, {0}"</span>, <span style="color:blue;">new</span> <span style="color:#2b91af;">FileInfo</span>(documentPath).Name.ToString()); } <span style="color:blue;">catch</span> (<span style="color:#2b91af;">Exception</span> ex) { _logger.ErrorFormat(<span style="color:#a31515;">"Failed to delete file in Pre Processing, {0}"</span>, ex); }
}
else
{
NewFilePath = documentPath;
}
2017-03-15 16:19:55,584 [3116] ERROR
iAScan.Plugins.Abbyy.AsposeProcessing [(null)] - Failed to delete file in Pre
Processing, System.IO.IOException: The process cannot access the file
‘D:\Data\Processing\fd82ab3d-4ecd-4609-9f62-f824c4b5e79c_2.pdf’ because it is
being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at iAScan.Plugins.Abbyy.AsposeProcessing.<>c__DisplayClass21_0.b__0(Object
o)
2017-03-15 16:19:55,678 [2172] ERROR iAScan.Plugins.Abbyy.AsposeProcessing
[(null)] - Failed to delete file in Pre Processing, System.IO.IOException: The
process cannot access the file
‘D:\Data\Processing\fd82ab3d-4ecd-4609-9f62-f824c4b5e79c_1.pdf’ because it is
being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at
iAScan.Plugins.Abbyy.AsposeProcessing.<>c__DisplayClass21_0.b__0(Object
o)
2017-03-15 16:19:55,678 [3116] ERROR iAScan.Plugins.Abbyy.AsposeProcessing
[(null)] - Failed to delete file in Pre Processing, System.IO.IOException: The
process cannot access the file
‘D:\Data\Processing\fd82ab3d-4ecd-4609-9f62-f824c4b5e79c_3.pdf’ because it is
being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String
maybeFullPath)
at System.IO.File.InternalDelete(String path, Boolean checkHost)
at System.IO.File.Delete(String path)
at
iAScan.Plugins.Abbyy.AsposeProcessing.<>c__DisplayClass21_0.b__0(Object
o)<o:p></o:p>