This commit is contained in:
parent
c7383915ec
commit
fed3b1e913
@ -365,7 +365,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mySection.IsStepSection)_MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
|
||||
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
|
||||
_MyHelper.MySection = mySection;
|
||||
OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG);
|
||||
}
|
||||
@ -373,11 +373,10 @@ namespace Volian.Print.Library
|
||||
string myPdfFile = null;
|
||||
_MyHelper.FinalMessageSectionID = finalMessageSectionID; // set VlnSvgPageHelper with the finalMessageSectionID
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mySection.IsStepSection)
|
||||
{
|
||||
if ((mySection.MyDocStyle.StructureStyle.Style ?? 0 & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
@ -397,7 +396,7 @@ namespace Volian.Print.Library
|
||||
using (PdfInfo myPdf = PdfInfo.Get(mySection))
|
||||
{
|
||||
sectPageCount = (int)(Math.Ceiling(myPdf.PageCount));
|
||||
locEndOfWordDoc = (float)(myPdf.PageCount - (sectPageCount-1)) * 100;
|
||||
locEndOfWordDoc = (float)(myPdf.PageCount - (sectPageCount - 1)) * 100;
|
||||
pdfSize = (float)myPdf.PageCount;
|
||||
}
|
||||
string tocKey = string.Format("TOC{0}", mySection.ItemID);
|
||||
@ -410,7 +409,6 @@ namespace Volian.Print.Library
|
||||
for (int ii = 0; ii < sectPageCount; ii++)
|
||||
{
|
||||
int pageNumber = 1 + ii;
|
||||
//mySection.PageNumForDocStyle = pageNumber;
|
||||
if (((mySection.MyDocStyle.StructureStyle.Style ?? 0) & E_DocStructStyle.UseSectionFoldout) != 0)
|
||||
DoFoldoutPage(cb, "Word Document", _TextLayer, _MyHelper);
|
||||
if (readerWord != null)
|
||||
@ -451,7 +449,6 @@ namespace Volian.Print.Library
|
||||
|
||||
OnStatusChanged("After NewPage", PromsPrinterStatusType.NewPage);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -459,6 +456,7 @@ namespace Volian.Print.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_MyHelper.BackgroundFile != null)
|
||||
{
|
||||
_MyHelper.MySvg = null;
|
||||
@ -490,6 +488,16 @@ namespace Volian.Print.Library
|
||||
_NoBreakYOffset = 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)
|
||||
{
|
||||
// The following adjustments are for WCN1:
|
||||
@ -504,11 +512,10 @@ namespace Volian.Print.Library
|
||||
|
||||
float yPageStartAdj = yPageStart - yadj;
|
||||
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 secTitlePos = (float)tOfC.TofCSecTitlePos + xAdjTitle;
|
||||
float secPagePos = (float)tOfC.TofCPageNumPos + xAdjNumber;
|
||||
float height = tOfC.Font.WindowsFont.Size * 1.5F;
|
||||
|
||||
if (ii.Sections != null)
|
||||
{
|
||||
@ -519,29 +526,28 @@ namespace Volian.Print.Library
|
||||
{
|
||||
// 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.
|
||||
Chunk chk = new Chunk(mySection.MyContent.Number, font);
|
||||
Paragraph myparagraph = new Paragraph(chk);
|
||||
myparagraph.Leading = font.Size;
|
||||
float height = font.Size * 1.5F;
|
||||
float width = chk.GetWidthPoint();
|
||||
string rtfText = GetRtfToC(mySection.MyContent.Number, tOfC);
|
||||
Paragraph myparagraphn = vlnPrintObject.RtfToParagraph(rtfText);
|
||||
float width = 0;
|
||||
foreach (Chunk chkt in myparagraphn.Chunks)
|
||||
width += chkt.GetWidthPoint();
|
||||
float numwidth = width;
|
||||
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);
|
||||
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.
|
||||
{
|
||||
cb.PdfDocument.NewPage();
|
||||
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
|
||||
// a few spaces after the number. The '18' below represents 3 chars.
|
||||
Chunk chkt = new Chunk(mySection.MyContent.Text, font);
|
||||
float adjSecTitlePos = secTitlePos;
|
||||
if (secNumPos + numwidth > secTitlePos)
|
||||
adjSecTitlePos = secNumPos + numwidth + 18 - xAdjTitleIndent;
|
||||
Paragraph myparagrapht = new Paragraph(chkt);
|
||||
myparagrapht.Leading = font.Size;
|
||||
rtfText = GetRtfToC(mySection.MyContent.Text, tOfC);
|
||||
Paragraph myparagrapht = vlnPrintObject.RtfToParagraph(rtfText);
|
||||
width = secPagePos - adjSecTitlePos - 6;
|
||||
retval = Rtf2Pdf.TextAt(cb, myparagrapht, leftMargin + adjSecTitlePos, yPageStart - yLocation, width, height, "", yBottomMargin);
|
||||
// add a template for the page number:
|
||||
|
Loading…
x
Reference in New Issue
Block a user