加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何在PdfSharp中添加文件链接?

发布时间:2020-12-16 01:30:00 所属栏目:百科 来源:网络整理
导读:我似乎无法让PdfSharp为这个注释显示图片.它没有PdfAnnotation.Icon属性,所以我无法设置它. XFont font = new XFont("Verdana",10);PdfPage page = wDoc.Parent.Page;XGraphics gfx = wDoc.Parent.gfx;XRect rec = gfx.Transformer.WorldToDefaultPage(new X
我似乎无法让PdfSharp为这个注释显示图片.它没有PdfAnnotation.Icon属性,所以我无法设置它.

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);

link.Rectangle = new PdfRectangle(rec);
page.Annotations.Add(link);

我已经把它弄到了那么远,并且注释已经存在,除了它是一个空白框!如何让它说些什么,甚至只是展示一张图片?

解决方法

您需要使用page.AddWebLink(AREArect),然后使用gfx.drawstring(AREArect)添加文本区域

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读