using ComPDFKit.Import; using ComPDFKit.PDFAnnotation; using ComPDFKit.PDFDocument; using ComPDFKit.PDFPage; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; namespace AnnotationTest { internal class AnnotationTest { static private string outputPath = Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))) + "\\Output\\Background"; static void Main(string[] args) { Console.WriteLine("Running Watermark test sample…\r\n"); SDKLicenseHelper.LicenseVerify(); CPDFDocument document = CPDFDocument.InitWithFilePath("CommonFivePage.pdf"); if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } CreateTestAnnots(document); } static private void CreateFreetextAnnotation(CPDFDocument document) { CPDFPage page = document.PageAtIndex(0); CPDFFreeTextAnnotation freeText = page.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_FREETEXT) as CPDFFreeTextAnnotation; freeText.SetContent("ComPDFKit"); freeText.SetRect(new CRect(0, 50, 50, 0)); } static private void CreateFreehandAnnotation(CPDFDocument document) { } static private void CreateShapeAnnotation(CPDFDocument document) { } static private void CreateNoteAnnotation(CPDFDocument document) { } static private bool CreateTestAnnots(CPDFDocument document) { CreateFreetextAnnotation(document); CreateFreehandAnnotation(document); CreateShapeAnnotation(document); CreateNoteAnnotation(document); return true; } } }