Added PDF SaveLink parameter to methods
Added PDF SaveLink Logic
This commit is contained in:
parent
ee198b5275
commit
8546a09674
@ -86,6 +86,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
public class PromsPrinter
|
||||
{
|
||||
private bool _SaveLinks = false;
|
||||
public bool SaveLinks
|
||||
{
|
||||
get { return _SaveLinks; }
|
||||
set { _SaveLinks = value; }
|
||||
}
|
||||
private string _Prefix = ""; // RHM20150506 Multiline ItemID TextBox
|
||||
public string Prefix
|
||||
{
|
||||
@ -207,7 +213,8 @@ namespace Volian.Print.Library
|
||||
get { return _MyReaderHelper; }
|
||||
set { _MyReaderHelper = value; }
|
||||
}
|
||||
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite, ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix)
|
||||
public PromsPrinter(ItemInfo myItem, string rev, string watermark, bool debugOutput, bool origPgBrk, string backgroundFolder, bool openPDF, bool overWrite,
|
||||
ChangeBarDefinition cbd, String pdfFile, bool insertBlankPages, bool batchPrint, string prefix, bool saveLinks)
|
||||
{
|
||||
Prefix = prefix; // RHM20150506 Multiline ItemID TextBox
|
||||
_MyItem = myItem;
|
||||
@ -223,6 +230,7 @@ namespace Volian.Print.Library
|
||||
_InsertBlankPages = insertBlankPages;
|
||||
_BatchPrint = batchPrint;
|
||||
_MyReaderHelper = new ReaderHelper(this);
|
||||
_SaveLinks = saveLinks;
|
||||
//_MyReaderHelper.LoadTree(myItem);
|
||||
}
|
||||
private string _BeforePageNumberPdf = null;
|
||||
|
@ -919,29 +919,42 @@ namespace Volian.Print.Library
|
||||
// Need to have a way to get to sections which do not have any output (header only)
|
||||
// Need to have a way to identify procedures
|
||||
//
|
||||
//if (IParagraph.Chunks.Count > 0)
|
||||
//{
|
||||
// Chunk chk1 = IParagraph.Chunks[0] as Chunk;
|
||||
// chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination
|
||||
// if (MyItemInfo.MyContent.ContentTransitionCount > 0)
|
||||
// {
|
||||
// TransitionInfo ti = MyItemInfo.MyContent.ContentTransitions[0];
|
||||
// if (ti.MyItemToID.MyProcedure.ItemID == MyItemInfo.MyProcedure.ItemID)
|
||||
// { // Local Go To
|
||||
// if (ti.MyItemToID.MyContent.Type > 19999)
|
||||
// foreach (Chunk chk in IParagraph.Chunks)
|
||||
// chk.SetLocalGoto(string.Format("ItemID={0}", ti.ToID));
|
||||
// }
|
||||
// else // Remote Go To
|
||||
// foreach (Chunk chk in IParagraph.Chunks)
|
||||
// chk.SetRemoteGoto(ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}", ti.ToID));
|
||||
// }
|
||||
if (IParagraph.Chunks.Count > 0 && MyPageHelper.MyPromsPrinter.SaveLinks)
|
||||
{
|
||||
Chunk chk1 = IParagraph.Chunks[0] as Chunk;
|
||||
//Console.WriteLine("\"Desination\"\t{0}", MyItemInfo.ItemID);
|
||||
if (MyItemInfo.MyContent.Text.ToUpper().Contains("LINK:TR"))
|
||||
Console.WriteLine("Missing Transition {0}",MyItemInfo.ItemID);
|
||||
chk1.SetLocalDestination(string.Format("ItemID={0}", MyItemInfo.ItemID)); // Destination
|
||||
if (MyItemInfo.MyContent.ContentTransitionCount > 0)
|
||||
{
|
||||
TransitionInfo ti = MyItemInfo.MyContent.ContentTransitions[0];
|
||||
ItemInfo tiDefault = GetDefaultItemInfo(ti.MyItemToID);
|
||||
if (ti.MyItemToID.MyProcedure.ItemID == MyItemInfo.MyProcedure.ItemID)
|
||||
{ // Local Go To
|
||||
if (ti.MyItemToID.MyContent.Type > 19999)
|
||||
foreach (Chunk chk in IParagraph.Chunks)
|
||||
{
|
||||
//Console.WriteLine("\"LocalGoTo\"\t{0}", tiDefault.ItemID);
|
||||
chk.SetLocalGoto(string.Format("ItemID={0}", tiDefault.ItemID));
|
||||
chk.SetBackground(Color.CYAN);
|
||||
chk.SetBackground(new Color(System.Drawing.Color.LightCyan));
|
||||
}
|
||||
}
|
||||
else // Remote Go To
|
||||
foreach (Chunk chk in IParagraph.Chunks)
|
||||
{
|
||||
//Console.WriteLine("\"RemoteGoTo\"\t{0}", tiDefault.ItemID);
|
||||
chk.SetRemoteGoto(ti.MyItemToID.MyProcedure.DisplayNumber.Replace("/", "_") + ".pdf", string.Format("ItemID={0}", tiDefault.ItemID));
|
||||
chk.SetBackground(new Color(System.Drawing.Color.PeachPuff));
|
||||
}
|
||||
}
|
||||
// MyPageHelper.BottomContent = yLocation - Height;
|
||||
//if (MyItemInfo.InList(39048)) Console.WriteLine("Here");
|
||||
}
|
||||
MyPageHelper.BottomContent = yLocation - (Height * MyPageHelper.YMultiplier);
|
||||
retval = Rtf2Pdf.TextAt(cb, IParagraph, XOffset, yLocation, Width, 100, DebugInfo + string.Format(",YLines = {0}", YSize / SixLinesPerInch), yBottomMargin);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
//}
|
||||
if (retval == 0) // problem occurred - paragraph was not able to be printed on page
|
||||
{ // pagination logic needs to be fixed.
|
||||
// oooooooooooo ooooooooo. o8o . o8o
|
||||
@ -969,6 +982,37 @@ namespace Volian.Print.Library
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
private ItemInfo GetDefaultItemInfo(ItemInfo myItemInfo)
|
||||
{
|
||||
if (myItemInfo.IsProcedure &&myItemInfo.Sections != null)
|
||||
{
|
||||
SectionInfo siProcedureSteps = null;
|
||||
foreach (SectionInfo si in myItemInfo.Sections)
|
||||
{
|
||||
if (si.IsDefaultSection)
|
||||
{
|
||||
if (si.Steps != null) return si.Steps[0];
|
||||
if (si.Sections != null) return si.Sections[0];
|
||||
return si;
|
||||
}
|
||||
if (si.DisplayText.Contains("Procedure Step"))
|
||||
siProcedureSteps = si;
|
||||
}
|
||||
if (siProcedureSteps != null)
|
||||
{
|
||||
if (siProcedureSteps.Steps != null) return siProcedureSteps.Steps[0];
|
||||
if (siProcedureSteps.Sections != null) return siProcedureSteps.Sections[0];
|
||||
return siProcedureSteps;
|
||||
}
|
||||
}
|
||||
if (myItemInfo.IsSection)
|
||||
{
|
||||
if (myItemInfo.Steps != null) return myItemInfo.Steps[0];
|
||||
if (myItemInfo.Sections != null) return myItemInfo.Sections[0];
|
||||
}
|
||||
return myItemInfo;
|
||||
}
|
||||
private static bool _MissingInitials = false;
|
||||
|
||||
public static bool MissingInitials
|
||||
@ -1415,7 +1459,7 @@ namespace Volian.Print.Library
|
||||
yPageStart = yTopMargin + YTopMost;
|
||||
DoCheckOffHeader(cb, MyItemInfo, yLocation, yTopMargin, yPageStart);
|
||||
SectionTopMessage(cb, yTopMargin, yLocation);
|
||||
if (doSectionContinue) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
|
||||
if (doSectionContinue ) DoTopContinueMsg(cb, ref yPageStart, yTopMargin, docstyle , null);
|
||||
// If "ContinueSectionHeader" (format flag) is true then print the section title with "(Continued)" appended to it
|
||||
if (!MyItemInfo.IsSection && MyItemInfo.ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.ContinueSectionHeader && (!MyItemInfo.IsSection || MyItemInfo.IsSeparateSubsection))
|
||||
{
|
||||
@ -2314,7 +2358,7 @@ namespace Volian.Print.Library
|
||||
if (this.MyItemInfo.ItemID != vPara.MyItemInfo.ItemID) // RHM20150507 Table Scrunch
|
||||
process.Add(vPara);
|
||||
else // RHM20150507 Table Scrunch
|
||||
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}", MyItemInfo.ItemID, MyItemInfo.ShortPath);
|
||||
_MyLog.WarnFormat("Step Could Have Fit {0}, {1}",MyItemInfo.ItemID,MyItemInfo.ShortPath);
|
||||
else if (!vPara.Processed && ((vPara.YOffset) < YTopMost))
|
||||
retval = Math.Min(retval, vPara.YTopMost);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user