B2018-071 Don't crash when trying to convert an invalid word document to PDF

This commit is contained in:
Rich
2018-05-07 16:05:07 +00:00
parent 86c85bee58
commit a2e0b9aee3
2 changed files with 10 additions and 2 deletions

View File

@@ -727,6 +727,8 @@ namespace VEPROMS.CSLA.Library
PdfInfo myPdf = PdfInfo.Get(sect,DocReplace!=null);
return true;
}
// B2018-071 Save list of DocIDs for invalid document so that error log messages are not repeated
private static List<int> _MissingDocs = new List<int>();
public static bool SetDocPdf(DocumentInfo docInfo, ItemInfo sect)
{
string pdfTmp = null;
@@ -737,6 +739,11 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if (!_MissingDocs.Contains(docInfo.DocID))// B2018-071 Only add the message once to the error log
{
_MyLog.WarnFormat("Error trying to create PDF DocID = {0}", docInfo.DocID);// 2018-071 MS Word section could not be converted to PDF
_MissingDocs.Add(docInfo.DocID);
}
return false;
}
if (pdfTmp == null) return false;