This commit is contained in:
parent
c7383915ec
commit
fed3b1e913
@ -373,11 +373,10 @@ namespace Volian.Print.Library
|
|||||||
string myPdfFile = null;
|
string myPdfFile = null;
|
||||||
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
|
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
|
||||||
SectionConfig sc = mySection.MyConfig as SectionConfig;
|
SectionConfig sc = mySection.MyConfig as SectionConfig;
|
||||||
if ((myProcedure.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.AutoTableOfContents) == E_PurchaseOptions.AutoTableOfContents && mySection.MyContent.Text.ToUpper() == "TABLE OF CONTENTS")
|
if (mySection.IsAutoTOCSection)
|
||||||
{
|
|
||||||
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
|
GenerateTOC(mySection, myProcedure, cb, _TextLayer);
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
if (mySection.IsStepSection)
|
if (mySection.IsStepSection)
|
||||||
{
|
{
|
||||||
if ((mySection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
if ((mySection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||||
@ -410,7 +409,6 @@ namespace Volian.Print.Library
|
|||||||
for (int ii = 0; ii < sectPageCount; ii++)
|
for (int ii = 0; ii < sectPageCount; ii++)
|
||||||
{
|
{
|
||||||
int pageNumber = 1 + ii;
|
int pageNumber = 1 + ii;
|
||||||
//mySection.PageNumForDocStyle = pageNumber;
|
|
||||||
if (((mySection.MyDocStyle.StructureStyle.Style ?? 0) & E_DocStructStyle.UseSectionFoldout) != 0)
|
if (((mySection.MyDocStyle.StructureStyle.Style ?? 0) & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||||
DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper);
|
DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper);
|
||||||
if (readerWord != null)
|
if (readerWord != null)
|
||||||
@ -451,7 +449,6 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -459,6 +456,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (_MyHelper.BackgroundFile != null)
|
if (_MyHelper.BackgroundFile != null)
|
||||||
{
|
{
|
||||||
_MyHelper.MySvg = null;
|
_MyHelper.MySvg = null;
|
||||||
@ -490,6 +488,16 @@ namespace Volian.Print.Library
|
|||||||
_NoBreakYOffset = 0;
|
_NoBreakYOffset = 0;
|
||||||
}
|
}
|
||||||
float lastyLocation = 0;
|
float lastyLocation = 0;
|
||||||
|
private string GetRtfToC(string txt, TableOfContentsData tOfCData)
|
||||||
|
{
|
||||||
|
StringBuilder _RtfSB = new StringBuilder();
|
||||||
|
Volian.Controls.Library.DisplayText toctxt = new Volian.Controls.Library.DisplayText(txt, tOfCData.Font, false);
|
||||||
|
System.Drawing.Font myFont = toctxt.TextFont.WindowsFont;
|
||||||
|
_RtfSB.Append(vlnPrintObject.AddFontTable(myFont));
|
||||||
|
_RtfSB.Append(toctxt.StartText);
|
||||||
|
_RtfSB.Append("}");
|
||||||
|
return _RtfSB.ToString();
|
||||||
|
}
|
||||||
private float AddSectionToTOC(SectionInfo tocSection, ItemInfo ii, TableOfContentsData tOfC, PdfContentByte cb, float yPageStart, float yLocation)
|
private float AddSectionToTOC(SectionInfo tocSection, ItemInfo ii, TableOfContentsData tOfC, PdfContentByte cb, float yPageStart, float yLocation)
|
||||||
{
|
{
|
||||||
// The following adjustments are for WCN1:
|
// The following adjustments are for WCN1:
|
||||||
@ -504,11 +512,10 @@ namespace Volian.Print.Library
|
|||||||
|
|
||||||
float yPageStartAdj = yPageStart - yadj;
|
float yPageStartAdj = yPageStart - yadj;
|
||||||
float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin;
|
float leftMargin = (float)tocSection.MyDocStyle.Layout.LeftMargin;
|
||||||
iTextSharp.text.Font font = FontFactory.GetFont(tOfC.Font.WindowsFont.Name, tOfC.Font.WindowsFont.Size, new iTextSharp.text.Color(PrintOverride.TextColor));
|
|
||||||
iTextSharp.text.Font font12cpi = FontFactory.GetFont(tOfC.Font.WindowsFont.Name, 10, new iTextSharp.text.Color(PrintOverride.TextColor));
|
|
||||||
float secNumPos = (float)tOfC.TofCSecNumPos + xAdjNumber;
|
float secNumPos = (float)tOfC.TofCSecNumPos + xAdjNumber;
|
||||||
float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle;
|
float secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle;
|
||||||
float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber;
|
float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber;
|
||||||
|
float height = tOfC.Font.WindowsFont.Size * 1.5F;
|
||||||
|
|
||||||
if (ii.Sections != null)
|
if (ii.Sections != null)
|
||||||
{
|
{
|
||||||
@ -519,29 +526,28 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
// need to do the section number, section title & page number. Page number
|
// need to do the section number, section title & page number. Page number
|
||||||
// has to be put on at end after number of page is known, so use a Template.
|
// has to be put on at end after number of page is known, so use a Template.
|
||||||
Chunk chk = new Chunk(mySection.MyContent.Number, font);
|
string rtfText = GetRtfToC(mySection.MyContent.Number, tOfC);
|
||||||
Paragraph myparagraph = new Paragraph(chk);
|
Paragraph myparagraphn = vlnPrintObject.RtfToParagraph(rtfText);
|
||||||
myparagraph.Leading = font.Size;
|
float width = 0;
|
||||||
float height = font.Size * 1.5F;
|
foreach (Chunk chkt in myparagraphn.Chunks)
|
||||||
float width = chk.GetWidthPoint();
|
width += chkt.GetWidthPoint();
|
||||||
float numwidth = width;
|
float numwidth = width;
|
||||||
float yBottomMargin = Math.Max(0, (float)tocSection.MyDocStyle.Layout.TopMargin - (float)tocSection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
|
float yBottomMargin = Math.Max(0, (float)tocSection.MyDocStyle.Layout.TopMargin - (float)tocSection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
|
||||||
Rtf2Pdf.Offset = new PointF(0, 2.5F);
|
Rtf2Pdf.Offset = new PointF(0, 2.5F);
|
||||||
float retval = Rtf2Pdf.TextAt(cb, myparagraph, leftMargin + secNumPos, yPageStart - yLocation, width*1.3F, height, "", yBottomMargin);
|
float retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos, yPageStart - yLocation, width*1.3F, height, "", yBottomMargin);
|
||||||
if (retval == 0) // do a newpage, it couldn't fit on current page.
|
if (retval == 0) // do a newpage, it couldn't fit on current page.
|
||||||
{
|
{
|
||||||
cb.PdfDocument.NewPage();
|
cb.PdfDocument.NewPage();
|
||||||
yLocation = 0;
|
yLocation = 0;
|
||||||
retval = Rtf2Pdf.TextAt(cb, myparagraph, leftMargin + secNumPos, yPageStart - yLocation, width*1.3F, height, "", yBottomMargin);
|
retval = Rtf2Pdf.TextAt(cb, myparagraphn, leftMargin + secNumPos, yPageStart - yLocation, width*1.3F, height, "", yBottomMargin);
|
||||||
}
|
}
|
||||||
// if the starting column of text would be in 'middle of' the number, just put it
|
// if the starting column of text would be in 'middle of' the number, just put it
|
||||||
// a few spaces after the number. The '18' below represents 3 chars.
|
// a few spaces after the number. The '18' below represents 3 chars.
|
||||||
Chunk chkt = new Chunk(mySection.MyContent.Text, font);
|
|
||||||
float adjSecTitlePos = secTitlePos;
|
float adjSecTitlePos = secTitlePos;
|
||||||
if (secNumPos + numwidth > secTitlePos)
|
if (secNumPos + numwidth > secTitlePos)
|
||||||
adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent;
|
adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent;
|
||||||
Paragraph myparagrapht = new Paragraph(chkt);
|
rtfText = GetRtfToC(mySection.MyContent.Text, tOfC);
|
||||||
myparagrapht.Leading = font.Size;
|
Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfText);
|
||||||
width = secPagePos - adjSecTitlePos - 6;
|
width = secPagePos - adjSecTitlePos - 6;
|
||||||
retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin);
|
retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin);
|
||||||
// add a template for the page number:
|
// add a template for the page number:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user