所谓墨痕注释即是客户在浏览PDF文件时随手涂鸦,就像看书时使用笔在书本上勾画重点一样,而在PDF阅读软件上要实现该功能怎么实现呢?
Gnostice PDFOne .NET是一款PDF文档处理控件,可以帮助开发人员快速实现该功能,可以在阅读PDF文档时使用鼠标在PDF文档上进行墨痕注释,具体怎么实现可以参考下面的代码:
// Open a PDF document
PDFDocument doc = new PDFDocument(PDFOne_License.KEY);
doc.Load("USPTO_Catalog.pdf");
doc.MeasurementUnit = PDFMeasurementUnit.Inches;
// Create the ink annoation
PDFInkAnnot ink = new PDFInkAnnot();
ink.Title = "Ink annotation demo";
ink.Subject = "Annotation Demo";
ink.Content = "This is an ink annotation.";
ink.Vertices =
new PointF[] {
new PointF(6.7f,2.4f),
new PointF(4.2f,2.6f),
new PointF(4.15f,3f),
new PointF(5.2f,3.4f),
new PointF(5.7f,3.3f),
new PointF(6.5f,3.1f),
new PointF(6.5f,2.1f)
};
ink.LineColor = Color.Red;
ink.LineStyle = PDFAnnotLineStyle.Solid;
// Add the ink annotation to page 1
doc.CurrentPageNo = 1;
doc.AddAnnot(ink);
doc.Save("ink_annotation_demo.pdf");
doc.Close();