Hello
A question about scripting in FC.
I have a image importation profile which imports attached files of emails : pdf essentially.
Nevertheless , today there are png and jpg files imported too. So I would like to delete these files by script before recognition.
My idea is : if the imageSource ends with pdf, it's ok ; in the other case KO, the file must be deleted.
Do you havec a sample of script in this mind ?
Thank you.
JA
Comments
1 comment
Good afternoon,
Finally, I've added a new workflow step in order to analyze the received files. This step is positioned before recognition.
Then, this automatic step is linked to a script :
using System;
foreach(IDocument doc in Batch.Documents){
IPage page=doc.Pages[0];
String filePath = page.ImageSourceFileSubPath;
if(!filePath.EndsWith(".pdf")) {
Processing.ReportMessage("Erreur à l'entrée : " + filePath + " n'est pas un PDF. Il va être supprimé !");
Batch.DeleteDocument(doc);
} else{
Processing.ReportMessage("Validation à l'entrée : " + filePath + " est pas un PDF. Il doit être conservé !");
}
}
If it can help someone.
Thanks a lot for all optimisation, too!
Please sign in to leave a comment.