Is it possible to add rectangle or other shape to pdf file using Aspose.PDF and make it not editable for user? Using .NET
Yes, it is possible to add rectangle in PDF using Aspose.PDF than you can set privileges on document. Please check following documentation to set required privileges on a PDF document, it will help you to accomplish the task.
Set Privileges on an Existing PDF File
Also please use following code to add rectangle in PDF.
string dataDir = RunExamples.GetDataDir_AsposePdf_Graphs();
// Create Document instance
Document doc = new Document();
// Add page to pages collection of PDF file
Page page = doc.Pages.Add();
// Create Graph instance
Aspose.Pdf.Drawing.Graph graph = new Aspose.Pdf.Drawing.Graph(100, 400);
// Add graph object to paragraphs collection of page instance
page.Paragraphs.Add(graph);
// Create Rectangle instance
Aspose.Pdf.Drawing.Rectangle rect = new Aspose.Pdf.Drawing.Rectangle(100, 100, 200, 120);
// Specify fill color for Graph object
rect.GraphInfo.FillColor = Aspose.Pdf.Color.Red;
// Add rectangle object to shapes collection of Graph object
graph.Shapes.Add(rect);
dataDir = dataDir + “CreateFilledRectangle_out.pdf”;
// Save PDF file
doc.Save(dataDir);
I mean block only one element. Not all document. Is it possible to block only one shape for editing?
I have observed the requirements shared by you and have created an investigation ticket with ID PDFNET-47673 in our issue tracking system to investigate whether it is possible to meet the illustrated requirements using Aspose.PDF or not. I will share the feedback with you in this regard as soon as it will be shared by our development team.