Beispiel #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);
        }
Beispiel #2
0
        public PdfLink makeLink(Rectangle rect, string destination, int linkType)
        {
            PdfLink link = new PdfLink(doc.NextObjectId(), rect);
            this.objects.Add(link);

            if (linkType == LinkSet.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;
        }