internal override void VisitHyperlink(Hyperlink hyperlink) { Font styleFont = hyperlink.Document.Styles["Hyperlink"].Font; if (hyperlink.font == null) hyperlink.Font = styleFont.Clone(); else FlattenFont(hyperlink.font, styleFont); }
/// <summary> /// Adds a new Hyperlink /// </summary> public Hyperlink AddHyperlink(string name, HyperlinkType type) { Hyperlink hyperlink = new Hyperlink(); hyperlink.Name = name; hyperlink.Type = type; this.Add(hyperlink); return hyperlink; }
void EndHyperlink(Hyperlink hyperlink, XUnit right, XUnit bottom) { this.hyperlinkRect.Width = right - this.hyperlinkRect.X; this.hyperlinkRect.Height = bottom - this.hyperlinkRect.Y; PdfPage page = this.gfx.PdfPage; if (page != null) { XRect rect = this.gfx.Transformer.WorldToDefaultPage(this.hyperlinkRect); switch (hyperlink.Type) { case HyperlinkType.Local: int pageRef = this.fieldInfos.GetPhysicalPageNumber(hyperlink.Name); if (pageRef > 0) page.AddDocumentLink(new PdfRectangle(rect), pageRef); break; case HyperlinkType.Web: page.AddWebLink(new PdfRectangle(rect), hyperlink.Name); break; case HyperlinkType.File: page.AddFileLink(new PdfRectangle(rect), hyperlink.Name); break; } this.hyperlinkRect = new XRect(); } }
/// <summary> /// Adds a new Hyperlink /// </summary> public void Add(Hyperlink hyperlink) { this.Elements.Add(hyperlink); }
void RealizeHyperlink(XUnit width) { XUnit top = this.currentYPosition; XUnit left = this.currentXPosition; XUnit bottom = top + this.currentVerticalInfo.height; XUnit right = left + width; Hyperlink hyperlink = GetHyperlink(); bool hyperlinkChanged = this.currentHyperlink != hyperlink; if (hyperlinkChanged) { if (this.currentHyperlink != null) EndHyperlink(this.currentHyperlink, left, bottom); if (hyperlink != null) StartHyperlink(left, top); this.currentHyperlink = hyperlink; } if (this.currentLeaf.Current == this.endLeaf.Current) { if (this.currentHyperlink != null) EndHyperlink(this.currentHyperlink, right, bottom); this.currentHyperlink = null; } }
internal HyperlinkRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer) : base(domObj, docRenderer) { this.hyperlink = domObj as Hyperlink; }
/// <summary> /// Adds a new Hyperlink of Type "Local", i.e. the Target is a Bookmark within the Document /// </summary> public Hyperlink AddHyperlink(string name) { Hyperlink hyperlink = new Hyperlink(); hyperlink.Name = name; Add(hyperlink); return hyperlink; }