示例#1
0
        public PdfLink MakeLink(Rectangle rect, string destination, LinkKind linkType)
        {
            PdfLink link = new PdfLink(doc.NextObjectId(), rect);

            this.objects.Add(link);

            if (linkType == LinkKind.External)
            {
                if (destination.EndsWith(".pdf"))
                { // FileSpec
                    PdfFileSpec fileSpec = new PdfFileSpec(doc.NextObjectId(), destination);
                    this.objects.Add(fileSpec);
                    PdfGoToRemote gotoR = new PdfGoToRemote(fileSpec, doc.NextObjectId());
                    this.objects.Add(gotoR);
                    link.SetAction(gotoR);
                }
                else
                { // URI
                    PdfUri uri = new PdfUri(destination);
                    link.SetAction(uri);
                }
            }
            else
            {
                PdfObjectReference goToReference = GetGoToReference(destination);
                PdfInternalLink    internalLink  = new PdfInternalLink(goToReference);
                link.SetAction(internalLink);
            }
            return(link);
        }
示例#2
0
文件: IDNode.cs 项目: nholik/Fo.Net
 internal void SetInternalLinkGoToPageReference(PdfObjectReference pageReference)
 {
     if (internalLinkGoTo != null)
     {
         internalLinkGoTo.PageReference = pageReference;
     }
     else
     {
         internalLinkGoToPageReference = pageReference;
     }
 }
示例#3
0
 /// <summary>
 ///     Class constructor.
 /// </summary>
 /// <param name="objectId">The object id number</param>
 /// <param name="title">The title of the outline entry (can only be null for root Outlines obj)</param>
 /// <param name="action">The page which this outline refers to.</param>
 public PdfOutline(PdfObjectId objectId, string title, PdfObjectReference action)
     : base(objectId)
 {
     this.subentries = new ArrayList();
     this.count = 0;
     this.parent = null;
     this.prev = null;
     this.next = null;
     this.first = null;
     this.last = null;
     this.title = title;
     this.actionRef = action;
 }
示例#4
0
 /// <summary>
 ///     Class constructor.
 /// </summary>
 /// <param name="objectId">The object id number</param>
 /// <param name="title">The title of the outline entry (can only be null for root Outlines obj)</param>
 /// <param name="action">The page which this outline refers to.</param>
 public PdfOutline(PdfObjectId objectId, string title, PdfObjectReference action)
     : base(objectId)
 {
     this.subentries = new ArrayList();
     this.count      = 0;
     this.parent     = null;
     this.prev       = null;
     this.next       = null;
     this.first      = null;
     this.last       = null;
     this.title      = title;
     this.actionRef  = action;
 }
示例#5
0
        public PdfOutline MakeOutline(PdfOutline parent, string label,
                                      string destination)
        {
            PdfObjectReference goToRef = GetGoToReference(destination);

            PdfOutline obj = new PdfOutline(doc.NextObjectId(), label, goToRef);

            if (parent != null)
            {
                parent.AddOutline(obj);
            }
            this.objects.Add(obj);
            return(obj);
        }
示例#6
0
 public void setInternalGoToPageReference(string id,
                                          PdfObjectReference pageReference)
 {
     IDNode node = (IDNode)idReferences[id];
     if (node != null)
     {
         node.SetInternalLinkGoToPageReference(pageReference);
     }
 }