Thanks for your inquiry. Please check following code snippet to add FreeAnnotation to show up without editing it. Moreover, please note by default it is editable. To restrict FreeAnnotation editing you need to set security privileges of the the document as following.
Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document(myDir + “HelloWorld.pdf”);<o:p></o:p>
// instantiate DefaultAppearance object
Aspose.Pdf.InteractiveFeatures.DefaultAppearance default_appearance = new DefaultAppearance("Arial", 12, System.Drawing.Color.Red);
FreeTextAnnotation freetext = new FreeTextAnnotation(pdfDocument.Pages[1],
new Aspose.Pdf.Rectangle(100,
650, 294, 700), default_appearance);
Aspose.Pdf.InteractiveFeatures.Annotations.Border border = new
Aspose.Pdf.InteractiveFeatures.Annotations.Border(freetext);
border.Style =
Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Solid;
border.Width = 2;
//border.Style =
Aspose.Pdf.InteractiveFeatures.Annotations.BorderStyle.Dashed;
border.EffectIntensity = 2;
freetext.Opacity = 10f;
freetext.Characteristics.Border = System.Drawing.Color.Black;
freetext.Border = border;
freetext.Contents = "Free
Text";
//freetext.Flags =
AnnotationFlags.Print | AnnotationFlags.NoView;
// add anootation to annotations
collection of page
pdfDocument.Pages[1].Annotations.Add(freetext);
//pdfDocument.Save(myDir +
"FreeTextAnnotation.pdf");
//Settting document privileges
DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.ChangeAllowLevel = 0;
privilege.AllowPrint = true;
PdfFileSecurity fileSecurity = new PdfFileSecurity();
fileSecurity.BindPdf(pdfDocument);
//set document privileges
fileSecurity.SetPrivilege(privilege);
// save final output file
fileSecurity.Save(myDir+"FreeTextAnnotation_Secured.pdf");
fileSecurity.Close();
fileSecurity.Dispose();
pdfDocument.Dispose();
Please feel free to contact us for any further assistance.
Best Regards,