diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs index 7a971ec4..91ceb688 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs @@ -115,6 +115,25 @@ namespace VEPROMS.CSLA.Library } public partial class PdfInfo { + // B2023-024 PROMS was using old cached PDF data when printing Word sections. + // Added this method that can be called to clear the PDF print cache for a specified section. + public static void RemovePDFFromCache(ItemInfo sect) + { + DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; + SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; + + int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave; + + if (sc != null && sc.Section_WordMargin == "Y") + { + RemoveFromCachedByPrimaryKey(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0); + } + else + { + RemoveFromCachedByPrimaryKey(sect.MyContent.MyEntry.DocID, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, + (int)myDocStyle.Layout.PageLength, (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth); + } + } public static PdfInfo Get(ItemInfo sect, bool ovrride) { int count = 0; diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs index 81a795e2..d9c233a8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/PdfInfo.cs @@ -71,6 +71,19 @@ namespace VEPROMS.CSLA.Library if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0]; return null; } + // B2023-024 PROMS was using old cached PDF data when printing Word sections. + // Added this method to clear the PDF print cache for a specified section. + // This is called from RemovePDFFromCache() in PDFExt.cs + protected static void RemoveFromCachedByPrimaryKey(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth) + { + ConvertListToDictionary(); + string key = docID.ToString() + "_" + debugStatus.ToString() + "_" + topRow.ToString() + "_" + pageLength.ToString() + "_" + leftMargin.ToString() + "_" + pageWidth.ToString(); + if (_CacheByPrimaryKey.ContainsKey(key)) + { + _CacheByPrimaryKey.Remove(key); + } + return; + } #endregion #region Business Methods private string _ErrorMessage = string.Empty; diff --git a/PROMS/Volian.Print.Library/PromsPrinter.cs b/PROMS/Volian.Print.Library/PromsPrinter.cs index 6126bd93..cd34b9a5 100644 --- a/PROMS/Volian.Print.Library/PromsPrinter.cs +++ b/PROMS/Volian.Print.Library/PromsPrinter.cs @@ -831,6 +831,13 @@ namespace Volian.Print.Library int profileDepth = ProfileTimer.Push(">>>> PrintProcedureOrFoldout"); Rtf2Pdf.TextAtCounter = 0; bool doingFoldout = myFoldoutSection != null; + // B2023-024 PROMS was using old cached PDF data when printing Word sections. + if (doingFoldout) + { + PdfInfo.RemovePDFFromCache((ItemInfo) myFoldoutSection); // remove cached PDF info to force getting of new data + if (File.Exists(outputFileName)) + File.Delete(outputFileName); // delete the temporary FOLDOUT file + } // The following line accounts for 16bit OverrideLeftMargin when the 'Absolute' attribute is used in the genmac. // We don't want to use the OverrideLeftMargin when 'Absolute' is used in the genmac. // It's set here because the Volian.Svg.Library cannot call back to Volian.Print.Library to get this value.