コード例 #1
0
ファイル: PdfCreator.cs プロジェクト: jps1974/SaveAsPdf
        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
ファイル: PdfCreator.cs プロジェクト: nholik/Fo.Net
        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;
        }