本文整理汇总了C#中iTextSharp.text.pdf.PdfOutline类的典型用法代码示例。如果您正苦于以下问题:C# PdfOutline类的具体用法?C# PdfOutline怎么用?C# PdfOutline使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfOutline类属于iTextSharp.text.pdf命名空间,在下文中一共展示了PdfOutline类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreatePdf
// ---------------------------------------------------------------------------
/**
* Creates a PDF document.
*/
public byte[] CreatePdf()
{
using (MemoryStream ms = new MemoryStream())
{
// step 1
using (Document document = new Document())
{
// step 2
PdfWriter writer = PdfWriter.GetInstance(document, ms);
// step 3
document.Open();
// step 4
PdfOutline root = writer.RootOutline;
PdfOutline movieBookmark;
PdfOutline link;
String title;
IEnumerable<Movie> movies = PojoFactory.GetMovies();
foreach (Movie movie in movies)
{
title = movie.MovieTitle;
if ("3-Iron".Equals(title))
title = "\ube48\uc9d1";
movieBookmark = new PdfOutline(root,
new PdfDestination(
PdfDestination.FITH, writer.GetVerticalPosition(true)
),
title, true
);
movieBookmark.Style = Font.BOLD;
link = new PdfOutline(movieBookmark,
new PdfAction(String.Format(RESOURCE, movie.Imdb)),
"link to IMDB"
);
link.Color = BaseColor.BLUE;
new PdfOutline(movieBookmark,
PdfAction.JavaScript(
String.Format(INFO, movie.Year, movie.Duration),
writer
),
"instant info"
);
document.Add(new Paragraph(movie.MovieTitle));
document.Add(PojoToElementFactory.GetDirectorList(movie));
document.Add(PojoToElementFactory.GetCountryList(movie));
}
}
return ms.ToArray();
}
}
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:53,代码来源:CreateOutlineTree.cs
示例2: PdfOutline
/**
* Constructs a <CODE>PdfOutline</CODE>.
* <P>
* This is the constructor for an <CODE>outline entry</CODE>. The open mode is
* <CODE>true</CODE>.
*
* @param parent the parent of this outline item
* @param destination the destination for this outline item
* @param title the title of this outline item
*/
public PdfOutline(PdfOutline parent, PdfDestination destination, PdfString title)
: this(parent, destination, title, true)
{
}
开发者ID:medvedttn,项目名称:itextsharp_mod-src,代码行数:14,代码来源:PdfOutline.cs
示例3: CreatePdfOutline
private PdfOutline CreatePdfOutline(PdfOutline parent, Bookmark bookmark)
{
return new PdfOutline(parent, PdfAction.GotoLocalPage(bookmark.PageNumber, new PdfDestination(bookmark.PageNumber), _writer), bookmark.Title);
}
开发者ID:marcostomazini,项目名称:ReleaseNotes,代码行数:4,代码来源:ReleaseNotesPdfWriter.cs
示例4: Add
//.........这里部分代码省略.........
CarriageReturn();
tabSettings = backupTabSettings;
PopLeading();
if (IsTagged(writer))
{
FlushLines();
text.CloseMCBlock(paragraph);
}
break;
}
case Element.SECTION:
case Element.CHAPTER: {
// Chapters and Sections only differ in their constructor
// so we cast both to a Section
Section section = (Section) element;
IPdfPageEvent pageEvent = writer.PageEvent;
bool hasTitle = section.NotAddedYet && section.Title != null;
// if the section is a chapter, we begin a new page
if (section.TriggerNewPage) {
NewPage();
}
if (hasTitle) {
float fith = IndentTop - currentHeight;
int rotation = pageSize.Rotation;
if (rotation == 90 || rotation == 180)
fith = pageSize.Height - fith;
PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
while (currentOutline.Level >= section.Depth) {
currentOutline = currentOutline.Parent;
}
PdfOutline outline = new PdfOutline(currentOutline, destination, section.GetBookmarkTitle(), section.BookmarkOpen);
currentOutline = outline;
}
// some values are set
CarriageReturn();
indentation.sectionIndentLeft += section.IndentationLeft;
indentation.sectionIndentRight += section.IndentationRight;
if (section.NotAddedYet && pageEvent != null)
if (element.Type == Element.CHAPTER)
pageEvent.OnChapter(writer, this, IndentTop - currentHeight, section.Title);
else
pageEvent.OnSection(writer, this, IndentTop - currentHeight, section.Depth, section.Title);
// the title of the section (if any has to be printed)
if (hasTitle) {
isSectionTitle = true;
Add(section.Title);
isSectionTitle = false;
}
indentation.sectionIndentLeft += section.Indentation;
// we process the section
element.Process(this);
// some parameters are set back to normal again
indentation.sectionIndentLeft -= (section.IndentationLeft + section.Indentation);
indentation.sectionIndentRight -= section.IndentationRight;
if (section.ElementComplete && pageEvent != null)
if (element.Type == Element.CHAPTER)
pageEvent.OnChapterEnd(writer, this, IndentTop - currentHeight);
else
pageEvent.OnSectionEnd(writer, this, IndentTop - currentHeight);
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:66,代码来源:PdfDocument.cs
示例5: TraverseOutlineCount
internal void TraverseOutlineCount(PdfOutline outline) {
List<PdfOutline> kids = outline.Kids;
PdfOutline parent = outline.Parent;
if (kids.Count == 0) {
if (parent != null) {
parent.Count = parent.Count + 1;
}
}
else {
for (int k = 0; k < kids.Count; ++k) {
TraverseOutlineCount(kids[k]);
}
if (parent != null) {
if (outline.Open) {
parent.Count = outline.Count + parent.Count + 1;
}
else {
parent.Count = parent.Count + 1;
outline.Count = -outline.Count;
}
}
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:23,代码来源:PdfDocument.cs
示例6: InitOutline
// methods
/** Helper for the constructors.
* @param parent the parent outline
* @param title the title for this outline
* @param open <CODE>true</CODE> if the children are visible
*/
internal void InitOutline(PdfOutline parent, string title, bool open)
{
this.open = open;
this.parent = parent;
writer = parent.writer;
Put(PdfName.TITLE, new PdfString(title, PdfObject.TEXT_UNICODE));
parent.AddKid(this);
if (destination != null && !destination.HasPage()) // bugfix Finn Bock
SetDestinationPage(writer.CurrentPage);
}
开发者ID:medvedttn,项目名称:itextsharp_mod-src,代码行数:16,代码来源:PdfOutline.cs
示例7: GenerateTo
public void GenerateTo(PdfOutline parentOutline)
{
if (_currentNode == null) return;
var startNode = Root.FirstChild();
Visit(parentOutline, startNode);
}
开发者ID:karak,项目名称:Geovanni,代码行数:7,代码来源:PdfOutlineBuilder.cs
示例8: Visit
private void Visit(PdfOutline parentOutline, OutlineNode node)
{
if (node == null) return;
var counterString = Path(node);
var thisOutline = new PdfOutline(parentOutline, PdfAction.GotoLocalPage(counterString, false), node.Title.ToString());
Visit(thisOutline, node.FirstChild());
Visit(parentOutline, node.NextSibling());
}
开发者ID:karak,项目名称:Geovanni,代码行数:9,代码来源:PdfOutlineBuilder.cs
示例9: AddBookContents
public void AddBookContents(PdfWriter writer, PdfOutline outline, BookContentNode content)
{
foreach (BookContentNode contentnode in content.Children)
{
int page = contentnode.Bookcontent.Page;
if (page > _book.PagesNum)
break;
page += _frontpagesinfo.DownloadedPages;
PdfAction action = PdfAction.GotoLocalPage(page, new PdfDestination(PdfDestination.FITB), writer);
AddBookContents(writer, new PdfOutline(outline, action, contentnode.Bookcontent.Title), contentnode);
}
}
开发者ID:leicheng1996,项目名称:eReading,代码行数:12,代码来源:Download.cs
示例10: HeaderNode
/**
* Constructor.
* @param level the level
* @param outline the PdfOutline for this HeaderNode
* @param parent the parent HeaderNode
*
*/
public HeaderNode(int level, PdfOutline outline, HeaderNode parent) {
this.level = level;
this.outline = outline;
this.parent = parent;
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:12,代码来源:HeaderNode.cs
示例11: Add
//.........这里部分代码省略.........
alignment = Element.ALIGN_LEFT;
indentLeft -= paragraph.IndentationLeft;
indentRight -= paragraph.IndentationRight;
CarriageReturn();
break;
}
case Element.SECTION:
case Element.CHAPTER: {
// Chapters and Sections only differ in their constructor
// so we cast both to a Section
Section section = (Section) element;
bool hasTitle = section.Title != null;
// if the section is a chapter, we begin a new page
if (section.TriggerNewPage) {
NewPage();
}
// otherwise, we begin a new line
else {
NewLine();
}
if (hasTitle) {
float fith = IndentTop - currentHeight;
int rotation = pageSize.Rotation;
if (rotation == 90 || rotation == 180)
fith = pageSize.Height - fith;
PdfDestination destination = new PdfDestination(PdfDestination.FITH, fith);
while (currentOutline.Level >= section.Depth) {
currentOutline = currentOutline.Parent;
}
PdfOutline outline = new PdfOutline(currentOutline, destination, section.GetBookmarkTitle(), section.BookmarkOpen);
currentOutline = outline;
}
// some values are set
CarriageReturn();
indentLeft += section.IndentationLeft;
indentRight += section.IndentationRight;
sectionIndentL += section.IndentationLeft;
sectionIndentR += section.IndentationRight;
IPdfPageEvent pageEvent = writer.PageEvent;
if (pageEvent != null)
if (element.Type == Element.CHAPTER)
pageEvent.OnChapter(writer, this, IndentTop - currentHeight, section.Title);
else
pageEvent.OnSection(writer, this, IndentTop - currentHeight, section.Depth, section.Title);
// the title of the section (if any has to be printed)
if (hasTitle) {
isParagraph = false;
Add(section.Title);
isParagraph = true;
}
indentLeft += section.Indentation;
sectionIndentL += section.Indentation;
// we process the section
element.Process(this);
// some parameters are set back to normal again
indentLeft -= section.IndentationLeft + section.Indentation;
indentRight -= section.IndentationRight;
sectionIndentL -= section.IndentationLeft + section.Indentation;
sectionIndentR -= section.IndentationRight;
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:66,代码来源:PdfDocument.cs
示例12: AddOutline
/**
* Adds a named outline to the document.
*
* @param outline the outline
* @param name the name for the local destination
*/
public void AddOutline(PdfOutline outline, string name)
{
CheckWriter();
pdf.AddOutline(outline, name);
}
开发者ID:HardcoreSoftware,项目名称:iSecretary,代码行数:11,代码来源:PdfContentByte.cs
示例13: AddKid
public void AddKid(PdfOutline outline)
{
kids.Add(outline);
}
开发者ID:medvedttn,项目名称:itextsharp_mod-src,代码行数:4,代码来源:PdfOutline.cs
示例14: AddOutline
/**
* Adds a named outline to the document .
* @param outline the outline to be added
* @param name the name of this local destination
*/
internal void AddOutline(PdfOutline outline, String name) {
LocalDestination(name, outline.PdfDestination);
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:8,代码来源:PdfDocument.cs
示例15: OutlineTree
internal void OutlineTree(PdfOutline outline) {
outline.IndirectReference = writer.PdfIndirectReference;
if (outline.Parent != null)
outline.Put(PdfName.PARENT, outline.Parent.IndirectReference);
List<PdfOutline> kids = outline.Kids;
int size = kids.Count;
for (int k = 0; k < size; ++k)
OutlineTree(kids[k]);
for (int k = 0; k < size; ++k) {
if (k > 0)
kids[k].Put(PdfName.PREV, kids[k - 1].IndirectReference);
if (k < size - 1)
kids[k].Put(PdfName.NEXT, kids[k + 1].IndirectReference);
}
if (size > 0) {
outline.Put(PdfName.FIRST, kids[0].IndirectReference);
outline.Put(PdfName.LAST, kids[size - 1].IndirectReference);
}
for (int k = 0; k < size; ++k) {
PdfOutline kid = kids[k];
writer.AddToBody(kid, kid.IndirectReference);
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:23,代码来源:PdfDocument.cs
示例16: Open
// [L1] DocListener interface
/**
* Opens the document.
* <P>
* You have to open the document before you can begin to add content
* to the body of the document.
*/
public override void Open() {
if (!open) {
base.Open();
writer.Open();
rootOutline = new PdfOutline(writer);
currentOutline = rootOutline;
}
InitPage();
if (IsTagged(writer))
openMCDocument = true;
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:19,代码来源:PdfDocument.cs
示例17: AddOutline
/**
* Adds an outline to the document.
*
* @param outline the outline
* @deprecated not needed anymore. The outlines are extracted
* from the root outline
*/
public void AddOutline(PdfOutline outline)
{
// for compatibility
}
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:11,代码来源:PdfContentByte.cs
注:本文中的iTextSharp.text.pdf.PdfOutline类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论