التعليقات التوضيحية هي وسيلة رائعة لتدوين الملاحظات على المستندات أو الصور أو أنواع الملفات الأخرى. يمكن استخدامها بشكل أفضل لتسليط الضوء أو شرح نقاط معينة أو تقديم ملاحظات أو مشاركة المعلومات داخل ملف بيانات. يمكن أيضًا إنشاء التعليقات التوضيحية مع أنواع خاصة من أدوات الترميز للتغلب على النص أو التمييز على النص أو الصور في مستند. هناك العديد من أنواع التعليقات التوضيحية المختلفة التي يمكن للمطورين استخدامها لأغراض مختلفة مثل المساحة المستطيلة ، والبولي ، والسهم ، والمسائل ، والرابط ، والعلامة المائية ، وشرح النص. إذا كنت تتطلع إلى أتمتة عمليات التعليق التوضيحي الخاص بك ومراقبة الصور الخاصة بك ، فيمكنك استخدام GroupDocs.Antation APIs لمنصات .NET و Java. تم تصميم هذه المكتبات القوية للعمل مع PDF و Microsoft Office (Word و Excel و PowerPoint و Visio) و Opendocument ورسومات CAD والصور ، بالإضافة إلى ملفات HTML وملفات البريد الإلكتروني التي تتيح .NET و JAVA مطوري تطبيقات لإضافة تعليقات إلى المستند بطريقة سهلة. تم تصميم واجهات برمجة التطبيقات للاستخدام في لغات C#و ASP.NET و VB.NET و Java ، عبر أطر وبيئات متعددة.
كمطور للتطبيقات ، فأنت تبحث دائمًا عن طرق لتبسيط عملية بناء التطبيقات وتوفير وقت الدوران.هذا هو المكان الذي تجلب فيه GroupDocs.Antation Apis براعة لا مثيل لها وتزويدك بالمنصة المناسبة.باستخدام هذه المكتبات الخفيفة الوزن ، يمكن للمطورين .NET و JAVA بناء حلول غنية وأكثر ذكاءً لإضافة التعليقات التوضيحية إلى مستندات PDF ، ومستندات Excel و PowerPoint وكذلك ملفات VSD و DWG و PNG و JPEG.
using (Annotator annotator = new Annotator("input.pdf"))
{
AreaAnnotation area = new AreaAnnotation
{
BackgroundColor = 65535,
Box = new Rectangle(100, 100, 100, 100),
CreatedOn = DateTime.Now,
Message = "This is area annotation",
Opacity = 0.7,
PageNumber = 0,
PenColor = 65535,
PenStyle = PenStyle.Dot,
PenWidth = 3,
Replies = new List
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(area);
annotator.Save("result.pdf");
}
using (Annotator annotator = new Annotator("input.pdf"))
{
ImageAnnotation area = new ImageAnnotation
{
Box = new Rectangle(100, 100, 100, 100),
Opacity = 0.7,
PageNumber = 0,
ImagePath = "www.google.com.ua/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png",
Angle = 100
};
annotator.Add(area);
annotator.Save("result.pdf");
}
Annotator annotator = new Annotator("inputPath");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());
Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());
java.util.List replies = new ArrayList();
replies.add(reply1);
replies.add(reply2);
// Create an instance of TextFieldAnnotation class and set options
TextFieldAnnotation textField = new TextFieldAnnotation();
textField.setBackgroundColor(65535);
textField.setBox(new Rectangle(100, 100, 100, 100));
textField.setCreatedOn(Calendar.getInstance().getTime());
textField.setText("Some text");
textField.setFontColor(65535);
textField.setFontSize((double)12);
textField.setMessage("This is text field annotation");
textField.setOpacity(0.7);
textField.setPageNumber(0);
textField.setPenStyle(PenStyle.Dot);
textField.setPenWidth((byte) 3);
textField.setReplies(replies);
// Add annotation and save to file
annotator.add(textField);
annotator.save("outputPath");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
Annotator annotator = new Annotator("inputPath");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());
Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());
java.util.List replies = Arrays.asList(reply1, reply2);
List points = Arrays.asList(new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650));
// Create an instance of LinkAnnotation class and set options
LinkAnnotation link = new LinkAnnotation();
link.setCreatedOn(Calendar.getInstance().getTime());
link.setMessage("This is link annotation");
link.setOpacity(0.7);
link.setPageNumber(0);
link.setPoints(points);
link.setReplies(replies);
link.setUrl("https://www.google.com");
// Add annotation and save to file
annotator.add(link);
annotator.save("outputPath");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
عادةً ما تستخدم العلامات المائية المستندة إلى النصوص في الملفات الرسمية والشخصية كرمز لحقوق الطبع والنشر أو العلامة التجارية ، أو تاريخ انتهاء الصلاحية ، أو أي شكل آخر من النصوص التي يجب عرضها في المستند.تتيح لك واجهة برمجة تطبيقات GroupDocs.Antation إضافة تعليقات توضيحية للعلامات المائية إلى ملفات بيانات مختلفة في .NET و Java.
using (Annotator annotator = new Annotator("input.pdf"))
{
WatermarkAnnotation watermark = new WatermarkAnnotation
{
Angle = 75,
Box = new Rectangle(200, 200, 100, 50),
CreatedOn = DateTime.Now,
Text = "Watermark",
FontColor = 65535,
FontSize = 12,
Message = "This is watermark annotation",
Opacity = 0.7,
AutoScale = true,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Replies = new List
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(watermark);
annotator.Save("result.pdf");
}
Annotator annotator = new Annotator("inputPath");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());
Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());
java.util.List replies = new ArrayList();
replies.add(reply1);
replies.add(reply2);
// Create an instance of WatermarkAnnotation class and set options
WatermarkAnnotation watermark = new WatermarkAnnotation();
watermark.setAngle((double) 75);
watermark.setBox(new Rectangle(200, 200, 100, 50));
watermark.setCreatedOn(Calendar.getInstance().getTime());
watermark.setText("Watermark");
watermark.setFontColor(65535);
watermark.setFontSize((double) 12);
watermark.setMessage("This is watermark annotation");
watermark.setOpacity(0.7);
watermark.setPageNumber(0);
watermark.setReplies(replies);
// Add annotation and save to file
annotator.add(watermark);
annotator.save("outputPath");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
للتمييز بين أجزاء معينة من النص من محتويات أخرى داخل المستند ، ستحتاج إلى تطبيق زينة ترميز النص عن طريق التأكيد على النص أو ضربه.تم دمج ميزات الترميز هذه في واجهات برمجة التطبيقات الخاصة بنا في شكل توضيحيات سطحية ومرضات يمكنك استخدامها في المستندات والصور الخاصة بك.
using (Annotator annotator = new Annotator("input.pdf"))
{
SquigglyAnnotation squiggly = new SquigglyAnnotation
{
CreatedOn = DateTime.Now,
FontColor = 65535,
BackgroundColor = 16761035,
Message = "This is squiggly annotation",
Opacity = 0.7,
PageNumber = 0,
SquigglyColor = 1422623, //Supported only Word and PDF
Points = new List
{
new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650)
},
Replies = new List
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(squiggly);
annotator.Save("result.pdf");
}
using (Annotator annotator = new Annotator("input.pdf"))
{
StrikeoutAnnotation strikeout = new StrikeoutAnnotation
{
CreatedOn = DateTime.Now,
FontColor = 65535,
BackgroundColor = 16761035,
Message = "This is strikeout annotation",
Opacity = 0.7,
PageNumber = 0,
Points = new List
{
new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650)
},
Replies = new List
{
new Reply
{
Comment = "First comment",
RepliedOn = DateTime.Now
},
new Reply
{
Comment = "Second comment",
RepliedOn = DateTime.Now
}
}
};
annotator.Add(strikeout);
annotator.Save("result.pdf");
}
Annotator annotator = new Annotator("inputPath");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());
Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());
java.util.List replies = new ArrayList();
replies.add(reply1);
replies.add(reply2);
Point point1 = new Point(80, 730);
Point point2 = new Point(240, 730);
Point point3 = new Point(80, 650);
Point point4 = new Point(240, 650);
List points = new ArrayList();
points.add(point1);
points.add(point2);
points.add(point3);
points.add(point4);
// Create an instance of HighlightAnnotation class and set options
HighlightAnnotation highlight = new HighlightAnnotation();
highlight.setBackgroundColor(65535);
highlight.setCreatedOn(Calendar.getInstance().getTime());
highlight.setFontColor(0);
highlight.setMessage("This is highlight annotation");
highlight.setOpacity(0.5);
highlight.setPageNumber(0);
highlight.setPoints(points);
highlight.setReplies(replies);
// Add annotation and save to file
annotator.add(highlight);
annotator.save("outputPath");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
Annotator annotator = new Annotator("inputPath");
try {
// Create an instance of Reply class and add comments
Reply reply1 = new Reply();
reply1.setComment("First comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());
Reply reply2 = new Reply();
reply2.setComment("Second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());
java.util.List replies = new ArrayList();
replies.add(reply1);
replies.add(reply2);
Point point1 = new Point(80, 730);
Point point2 = new Point(240, 730);
Point point3 = new Point(80, 650);
Point point4 = new Point(240, 650);
List points = new ArrayList();
points.add(point1);
points.add(point2);
points.add(point3);
points.add(point4);
// Create an instance of AreaAnnotation class and set options
UnderlineAnnotation underline = new UnderlineAnnotation();
underline.setCreatedOn(Calendar.getInstance().getTime());
underline.setFontColor(65535);
underline.setMessage("This is underline annotation");
underline.setOpacity(0.1);
underline.setPageNumber(0);
underline.setPoints(points);
underline.setReplies(replies);
// Add annotation and save to file
annotator.add(underline);
annotator.save("outputPath");
} finally {
if (annotator != null) {
annotator.dispose();
}
}
لا يمكنك إضافة تعليقات جديدة فحسب ، بل أيضًا استخراج التعليقات التوضيحية الحالية من ملفاتك وإزالة التعليقات التوضيحية المضافة قبل تصدير المستند إلى حالة ما قبل التثبيت عبر تطبيقات C#و ASP.NET و VB.NET و Java.
using (Annotator annotator = new Annotator("annotated.pdf"))
{
List annotations = annotator.Get();
XmlSerializer formatter = new XmlSerializer(typeof(List));
using (FileStream fs = new FileStream("annotations.xml", FileMode.Create))
{
fs.SetLength(0);
formatter.Serialize(fs, annotations);
}
}
LoadOptions tmp0 = new LoadOptions();
// Create an instance of Annotator class
Annotator annotator = new Annotator("InputPath", tmp0);
// Get all annotations
List annotations = annotator.get();
// Create an instance of Annotator class
Annotator annotator = new Annotator("inputPath");
SaveOptions saveOptions = new SaveOptions();
saveOptions.setAnnotationTypes(AnnotationType.None);
// Save result to file
annotator.save("outputPath", saveOptions);