Corrected Bookmarks for PDFs to support subsections
This commit is contained in:
parent
f20adce7ef
commit
cbd9026fc6
@ -25,11 +25,10 @@ namespace Volian.Print.Library
|
||||
get { return _PageBookmarks; }
|
||||
set { _PageBookmarks = value; }
|
||||
}
|
||||
private PdfOutline _MyPdfOutline = null;
|
||||
public PdfOutline MyPdfOutline
|
||||
private List<PdfOutline> _MyPdfOutlines = new List<PdfOutline>();
|
||||
public List<PdfOutline> MyPdfOutlines
|
||||
{
|
||||
get { return _MyPdfOutline; }
|
||||
set { _MyPdfOutline = value; }
|
||||
get { return _MyPdfOutlines; }
|
||||
}
|
||||
private ChkListBoxesHelper _CheckListBoxes = null;
|
||||
private ChkListBoxesHelper CheckListBoxes
|
||||
@ -540,12 +539,23 @@ namespace Volian.Print.Library
|
||||
{
|
||||
foreach (PageBookmark pb in PageBookmarks)
|
||||
{
|
||||
if (!pb.MyItemInfo.IsSection && MyPdfOutline != null)
|
||||
new PdfOutline(MyPdfOutline, pb.PdfDestination,Regex.Replace(pb.Title, @"\\{Prerequisite Step: .*?\\}", ""), false);
|
||||
else
|
||||
int lev = pb.Level;
|
||||
if (MyPdfOutlines.Count < lev || lev==0)
|
||||
{
|
||||
PdfDestination dest = new PdfDestination(PdfDestination.FIT);
|
||||
MyPdfOutline = new PdfOutline(writer.DirectContent.RootOutline, dest, pb.Title, false);
|
||||
PdfOutline pdo = new PdfOutline(writer.DirectContent.RootOutline, dest, pb.Title, false);
|
||||
if (MyPdfOutlines.Count == lev)
|
||||
MyPdfOutlines.Add(pdo);
|
||||
else
|
||||
MyPdfOutlines[lev] = pdo;
|
||||
}
|
||||
else
|
||||
{
|
||||
PdfOutline pdo = new PdfOutline(MyPdfOutlines[lev-1], pb.PdfDestination,Regex.Replace(pb.Title, @"\\{Prerequisite Step: .*?\\}", ""), false);
|
||||
if (MyPdfOutlines.Count == lev)
|
||||
MyPdfOutlines.Add(pdo);
|
||||
else
|
||||
MyPdfOutlines[lev] = pdo;
|
||||
}
|
||||
}
|
||||
PageBookmarks.Clear();
|
||||
@ -2138,6 +2148,29 @@ namespace Volian.Print.Library
|
||||
_Title = title;
|
||||
_PdfDestination = pdfDestination;
|
||||
}
|
||||
internal bool IsTopLevel
|
||||
{
|
||||
get
|
||||
{
|
||||
ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo;
|
||||
if (parent == null || parent.IsProcedure) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
internal int Level
|
||||
{
|
||||
get
|
||||
{
|
||||
int level = 0;
|
||||
ItemInfo parent = MyItemInfo.ActiveParent as ItemInfo;
|
||||
while (parent != null && !parent.IsProcedure)
|
||||
{
|
||||
level++;
|
||||
parent = parent.ActiveParent as ItemInfo;
|
||||
}
|
||||
return level;
|
||||
}
|
||||
}
|
||||
}
|
||||
public class ChangeBarDefinition // anything that is section level should go in here.
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user