F2023-035: WCN Supplemental information pages, when duplex print need left margin adjustment for hole punch

This commit is contained in:
Kathy Ruffing 2023-03-21 15:12:34 +00:00
parent 1fa6b5f7d8
commit 764e5b2bbd
5 changed files with 44 additions and 22 deletions

Binary file not shown.

View File

@ -171,6 +171,18 @@ namespace VEPROMS.CSLA.Library
return LazyLoad(ref _SupplementalInformation, "@SupplementalInformation"); return LazyLoad(ref _SupplementalInformation, "@SupplementalInformation");
} }
} }
// F2023-035: WCN - allow for change in left margin for supplemental information pages by
// setting a value in the DocStyle for the adjustment. This is used when importing the vlnParagraph page
// page & when doing pagelist items
private LazyLoad<float?> _SupInfoMargAdj;
public float? SupInfoMargAdj
{
get
{
return LazyLoad(ref _SupInfoMargAdj, "@SupInfoMargAdj");
}
}
#endregion #endregion
#region LandscapePageList #region LandscapePageList
[Category("Miscellaneous")] [Category("Miscellaneous")]

View File

@ -2618,7 +2618,11 @@ namespace Volian.Print.Library
string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf"; string SupInfoPdfName = Volian.Base.Library.VlnSettings.TemporaryFolder + @"\SupInfo" + myPageHelper.MySection.ItemID.ToString() + @".pdf";
PdfReader pdfreader = new PdfReader(SupInfoPdfName); PdfReader pdfreader = new PdfReader(SupInfoPdfName);
sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1); sipage = cb.PdfWriter.GetImportedPage(pdfreader, getpage+1);
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, 0, 0); // F2023-035: WCN - allow for change in left margin for supplemental information pages by
// setting a value in the DocStyle for the adjustment. When importing the vlnParagraph page
// use this adjustment (note that page list items are done in VlnSvgPageHelper)
float lmargadj = myPageHelper.MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)myPageHelper.MySection.MyDocStyle.SupInfoMargAdj;
AddImportedPageToLayer(cb.PdfWriter.DirectContent, textLayer, sipage, lmargadj, 0);
DoingFacingPage = true; DoingFacingPage = true;
myPageHelper.ResetSvg(); myPageHelper.ResetSvg();
NewPage(); NewPage();

View File

@ -1037,6 +1037,7 @@ i = 0;
HLSText = hlsText; HLSText = hlsText;
HasHLSTextId = hlsItemId; HasHLSTextId = hlsItemId;
MyPromsPrinter = myPromsPrinter; MyPromsPrinter = myPromsPrinter;
CreatingSupInfoPage = myPromsPrinter.DoingFacingPage;
MySection = mySection; MySection = mySection;
} }
private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad) private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection, bool forceLoad)
@ -1345,6 +1346,10 @@ i = 0;
bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms) bool usePSIvalue = false; // C2021-065 used with ROLkUpMatch pagelist flag (Barakah Alarms)
string otherChildUnit = string.Empty; // C2021-065 used when OTHER applicability information is used for the ROLookUp string otherChildUnit = string.Empty; // C2021-065 used when OTHER applicability information is used for the ROLookUp
// F2023-035: WCN - allow for change in left margin for supplemental information pages by
// setting a value in the DocStyle for the adjustment.
float supInfoMargAdj = 0;
if (CreatingSupInfoPage || MyPromsPrinter.DoingFacingPage) supInfoMargAdj = MySection.MyDocStyle.SupInfoMargAdj == null ? 0 : (float)MySection.MyDocStyle.SupInfoMargAdj;
foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems) foreach (VEPROMS.CSLA.Library.PageItem pageItem in pageStyle.PageItems)
{ {
if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup! if (pageItem.Token == null) continue; // can be null if token is dependent on PSI lookup!
@ -1392,7 +1397,7 @@ i = 0;
foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup() foreach (Match m in sm) // resolve pagelist tokens that are parameters for ROLookup()
{ {
string tnk = m.Value; string tnk = m.Value;
ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk); ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref parms, tnk, supInfoMargAdj);
} }
string[] parts = parms.Split(",".ToCharArray());// split on comma string[] parts = parms.Split(",".ToCharArray());// split on comma
// B2019-031 Support commas embedded in Alarm ID (Procedure Number) // B2019-031 Support commas embedded in Alarm ID (Procedure Number)
@ -1515,7 +1520,7 @@ i = 0;
foreach (Match subMatch in subMatches) foreach (Match subMatch in subMatches)
{ {
string subToken = subMatch.Value; string subToken = subMatch.Value;
ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken); ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj);
} }
} }
} }
@ -1570,7 +1575,7 @@ i = 0;
foreach (Match subMatch in subMatches) foreach (Match subMatch in subMatches)
{ {
string subToken = subMatch.Value; string subToken = subMatch.Value;
ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken); ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, subToken, supInfoMargAdj);
} }
} }
} }
@ -1578,19 +1583,19 @@ i = 0;
else else
{ {
if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token)) break; if (!ProcessPaglistToken(section, svgGroup, pageItem, ref useFontForCheckOffHeader, ref plstr, token, supInfoMargAdj)) break;
} }
} // end foreach matches } // end foreach matches
if (plstr != string.Empty) if (plstr != string.Empty)
{ {
if (useFontForCheckOffHeader != null) if (useFontForCheckOffHeader != null)
svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection)); svgGroup.Add(PageItemToSvgText(pageItem, plstr, useFontForCheckOffHeader, MySection, supInfoMargAdj));
else else
svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj));
} }
} }
else else
svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection)); svgGroup.Add(PageItemToSvgText(pageItem, pltok, MySection, supInfoMargAdj));
} }
} }
// Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way // Proms page numbering designed requires a "{PAGE}" token to increment the page counter. So the easiest way
@ -1698,7 +1703,7 @@ i = 0;
/// true - if token is resolved /// true - if token is resolved
/// false - if entire text is processed /// false - if entire text is processed
/// </returns> /// </returns>
private bool ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token) private bool ProcessPaglistToken(VEPROMS.CSLA.Library.SectionInfo section, SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, ref VE_Font useFontForCheckOffHeader, ref string plstr, string token, float supInfoMargAdj)
{ {
bool retval = true; bool retval = true;
@ -1751,7 +1756,7 @@ i = 0;
case "{BOX9}": case "{BOX9}":
case "[BOX9]": case "[BOX9]":
plstr = plstr.Replace(token, string.Empty); plstr = plstr.Replace(token, string.Empty);
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token))); svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(token), supInfoMargAdj));
break; break;
case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns case "{PMODEBOX}": // need to set either 1 or 2 depending on number of columns
case "[PMODEBOX]": case "[PMODEBOX]":
@ -1764,7 +1769,7 @@ i = 0;
box = "2"; box = "2";
box = "{BOX" + box + "}"; box = "{BOX" + box + "}";
plstr = plstr.Replace(token, string.Empty); plstr = plstr.Replace(token, string.Empty);
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box))); svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box), supInfoMargAdj));
break; break;
case "{DRAFTPAGE}": case "{DRAFTPAGE}":
//if (!AllowedWatermarks.Contains("Draft")) AllowedWatermarks.Add("Draft"); -- B2018-124 not needed anymore //if (!AllowedWatermarks.Contains("Draft")) AllowedWatermarks.Add("Draft"); -- B2018-124 not needed anymore
@ -2059,7 +2064,7 @@ i = 0;
VE_Font vf = sindx <= 0 ? pageItem.Font : VE_Font vf = sindx <= 0 ? pageItem.Font :
section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font; section.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.CheckOffHeaderList[sindx].Font;
useFontForCheckOffHeader = vf; useFontForCheckOffHeader = vf;
PageListCheckOffHeader = PageItemToSvgText(pageItem, pageItem.Token, vf, section); PageListCheckOffHeader = PageItemToSvgText(pageItem, pageItem.Token, vf, section, 0);
break; break;
case "{HLSTEXT}": case "{HLSTEXT}":
DidHLSText = true; DidHLSText = true;
@ -2199,7 +2204,7 @@ i = 0;
if (HLSTAB.Contains("{!Clock}")) // F2022-024 replace with the clock symbol defined in GenMac format file if (HLSTAB.Contains("{!Clock}")) // F2022-024 replace with the clock symbol defined in GenMac format file
{ {
HLSTAB = HLSTAB.Replace("{!Clock}",string.Empty).TrimStart(" ".ToCharArray()); HLSTAB = HLSTAB.Replace("{!Clock}",string.Empty).TrimStart(" ".ToCharArray());
svgGroup.Add(PageItemToSvgUse(pageItem, "Clock")); svgGroup.Add(PageItemToSvgUse(pageItem, "Clock", supInfoMargAdj));
} }
plstr = plstr.Replace(token, HLSTAB); plstr = plstr.Replace(token, HLSTAB);
break; break;
@ -2318,7 +2323,7 @@ i = 0;
if (token.Contains(@"RO-")) if (token.Contains(@"RO-"))
{ {
plstr = token.Replace("{",string.Empty).Replace("}",string.Empty); plstr = token.Replace("{",string.Empty).Replace("}",string.Empty);
svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, 0));
} }
if (token.Contains(@"PS-")) if (token.Contains(@"PS-"))
{ {
@ -2379,7 +2384,7 @@ i = 0;
{ {
if (plstr != string.Empty) if (plstr != string.Empty)
{ {
svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection)); svgGroup.Add(PageItemToSvgText(pageItem, plstr, MySection, supInfoMargAdj));
plstr = string.Empty; plstr = string.Empty;
} }
//svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token)); //svgGroup.Add(PageItemToSvgText(pageItem, pageItem.Token));
@ -2734,21 +2739,21 @@ i = 0;
} }
return len; return len;
} }
private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName) private SvgPart PageItemToSvgUse(VEPROMS.CSLA.Library.PageItem pageItem, string templateName, float supmargadj)
{ {
SvgUse svgUse = new SvgUse(); SvgUse svgUse = new SvgUse();
svgUse.UseID = templateName; svgUse.UseID = templateName;
svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0), E_MeasurementUnits.PT); svgUse.X = new SvgMeasurement((float)(pageItem.Col ?? 0) + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust
svgUse.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT); svgUse.Y = new SvgMeasurement((float)(pageItem.Row ?? 0), E_MeasurementUnits.PT);
return svgUse; return svgUse;
} }
private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, VE_Font font, SectionInfo mySection) private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, VE_Font font, SectionInfo mySection, float supmargadj)
{ {
SvgText svgText = PageItemToSvgText(pageItem, text, mySection); SvgText svgText = PageItemToSvgText(pageItem, text, mySection, supmargadj);
svgText.Font = font.WindowsFont; svgText.Font = font.WindowsFont;
return svgText; return svgText;
} }
private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection) private static SvgText PageItemToSvgText(VEPROMS.CSLA.Library.PageItem pageItem, string text, SectionInfo mySection, float supmargadj)
{ {
SvgText svgText = new SvgText(); SvgText svgText = new SvgText();
// F2021-053: Do replace words for Page List items. Send format items down to svgtext. // F2021-053: Do replace words for Page List items. Send format items down to svgtext.
@ -2797,8 +2802,9 @@ i = 0;
int dotsPerChar = (int)(2400 / (mySection.MyDocStyle.Layout.PageWidth / 6)); int dotsPerChar = (int)(2400 / (mySection.MyDocStyle.Layout.PageWidth / 6));
lcol = (lcol * 25) / dotsPerChar; lcol = (lcol * 25) / dotsPerChar;
} }
// F2023-035: WCN - allow for change in left margin for supplemental information pages by
svgText.X = new SvgMeasurement((float)lcol - colAdj16bit, E_MeasurementUnits.PT); // setting a value in the DocStyle for the adjustment.
svgText.X = new SvgMeasurement((float)lcol - colAdj16bit + supmargadj, E_MeasurementUnits.PT); // F2023-035: Add in supplemental info margin adjust
svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT); svgText.Y = new SvgMeasurement(row, E_MeasurementUnits.PT);
if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace if (svgText.Font.Underline && svgText.Text.EndsWith(" ")) svgText.Text = svgText.Text.Substring(0, svgText.Text.Length - 1) + "\xA0";// replace last space with a hardspace
// C2018-004 create meta file for baseline compares // C2018-004 create meta file for baseline compares