How to I added a path/rectangle to an existing PDF?


I am simply trying to put a rectangle on a PDF, say white to block out certain areas but I cant get the code to run, can you point me to some sample code please.

Just open a pdf, add a rectangle save and close.


I suggest taking a look at ElementBuilder sample (included as part of the SDK):

For example:

ElementBuilder eb = new ElementBuilder();

ElementWriter writer = new ElementWriter();

Page page = doc.GetPage(1);


Element element = eb.CreateRect(new Rect(100, 100, 300, 400));



writer.End(); // save changes to the current page


Btw. it you want to redact PDF, the proper tool to use is ‘pdftron.PDF.Redacrtor’ ( Adding stuff on top of page does not really remove sensitive info.