如何添加一个链接到PdfSharp文件? [英] How do I add a link to a file in PdfSharp?
本文介绍了如何添加一个链接到PdfSharp文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我似乎无法得到PdfSharp以显示此标注的图片。它不具有PdfAnnotation.Icon财产,所以我不能设置。
I can't seem to get PdfSharp to show a picture for this annotation. It doesn't have the PdfAnnotation.Icon property, so I can't set that.
XFont font = new XFont("Verdana", 10);
PdfPage page = wDoc.Parent.Page;
XGraphics gfx = wDoc.Parent.gfx;
XRect rec = gfx.Transformer.WorldToDefaultPage(new XRect(new XPoint(30, 60), new XSize(30, 30)));
PdfRectangle rect = new PdfRectangle(rec);
PdfLinkAnnotation link = PdfLinkAnnotation.CreateFileLink(rect, wDoc.FileLocation);
gfx.DrawString("These files were attached:", font, XBrushes.Black, 30, 50, XStringFormat.Default);
gfx.
link.Rectangle = new PdfRectangle(rec);
page.Annotations.Add(link);
我已经得到了那么远,与注解确实存在,但它是一个空白框!我该如何去使它说些什么,甚至只是出现画面?
I've gotten it that far, and the annotation DOES exist, except it's a blank box! How do I go about making it say something, or even just show a picture?
推荐答案
您需要使用page.AddWebLink(AREArect),然后用gfx.drawstring添加文本区域(AREArect)
You need to use page.AddWebLink(AREArect) and then add the text area with gfx.drawstring(AREArect)
这篇关于如何添加一个链接到PdfSharp文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文