Editing an existing Annotation

Hi,
I have an annotation (Stamp) added to an existing PDF document.
I want to void that stamp by putting a water mark over the stamp : void by User
Is this achievable with Aspose PDF Kit?

If that is not possible, can I edit the content of an existing annotation and appending the text : void by User
I found this sample that uses ModifyAnnotation() method.
Aspose.Total for .NET|Documentation
But that is adding a new annotation.
How do I get an existing annotation and edit it’s text?

Thanks,
Sudheer

Hi Sudheer,

Please share a sample PDF file with us, so we could look into your scenario at our end. We’ll update you with the results accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Shahzad,
I am attaching a PDF that has got a stamp. (TestNotice_Out.pdf)
The stamp was created using : PdfFileStamp class.

Now the user needs to put a new stamp and void this existing stamp.
The requirement is to put a void water mark on top of the stamp, like the water mark is put across a page with text:
void
by domain\user


Diagonal void water mark is required.
____________
| |
| |
| |
___________

If that is hard to achieve, then is there a way to exit the existing water mark text with the void information.

Hope the requirement is clear now.

Thanks!


Hi Sudheer,

I have tried to get the stamp using both Stamp and Watermark annotation types, but couldn’t fetch it. Please confirm that the following text was added as a stamp:

FILED
On
6/25/2010
By
Courts/Skumar

Also, Please share the code snippet you used to add this stamp. I’m afraid, currently I’m unable to find any way to modify this stamp text, however please share the above details, so I could further investigate it.

We’re sorry for the inconvenience.
Regards,

This is the code I used for adding the Stamp.

string inputFile = @“C:\TestNotice.pdf”;
string outputFile = @“C:\TestNotice_Out.pdf”;

Aspose.Pdf.Kit.PdfFileStamp stamper = new Aspose.Pdf.Kit.PdfFileStamp(inputFile, outputFile);
int pageNumber = 1;
Aspose.Pdf.Kit.Stamp aStamp = null;
aStamp = new Aspose.Pdf.Kit.Stamp();

//Add another line for Stamp

Aspose.Pdf.Kit.FormattedText text = new Aspose.Pdf.Kit.FormattedText(“FILED”,
System.Drawing.Color.FromArgb(0, 0, 0)
, Aspose.Pdf.Kit.FontStyle.TimesRoman
, Aspose.Pdf.Kit.EncodingType.Winansi
, false
, 10);
text.AddNewLineText(" On “);
text.AddNewLineText(DateTime.Now.ToShortDateString());
text.AddNewLineText(” By ");
text.AddNewLineText(“Courts/Skumar”);
aStamp.BindLogo(text

);
aStamp.IsBackground = true;
aStamp.Opacity = 1f;
//Only on the first page
aStamp.Pages = new int[] { pageNumber };
aStamp.Rotation = 0;

//Top right corner, it is measured from the bottom left corner of the page
aStamp.SetOrigin(stamper.PageWidth * 6 / 10, stamper.PageHeight - 50);

stamper.AddStamp(aStamp);
stamper.Close();


Please let me know if you need any other info from me.

Thanks!

Hi Sudheer,

There are two possibilities to achieve your goal. You can either add a new stamp with the new text on the existing stamp, or you can simply add text on the existing stamp using the following code snippet:


//create PdfFileMend object

Aspose.Pdf.Kit.PdfFileMend pdfMender = new Aspose.Pdf.Kit.PdfFileMend(“TestNotice_Out.pdf”, “output_mend.pdf”);

//create FormattedText object

Aspose.Pdf.Kit.FormattedText formattedText = new Aspose.Pdf.Kit.FormattedText(“Void by user name”);

//add text at the specified location

pdfMender.AddText(formattedText, 1, 400,220);

//close output file

pdfMender.Close();

I hope this helps. If you have any further questions, please do let us know.
Regards,

Hi Shahzad,
I have got my requirement satisfied except these issues. I will explain my scenarios so that they are more clear.

Give Border To Stamp:
The user want to put stamps on documents as I explained above.
Now I want to give a border to the stamp?
Can I do that with stamp class?


Adding another Stamp:
Now the user may need to put another stamp voiding the previous one.
I want to make the previous stamp less opaque and then, put a VOID on top of it and put the new stamp below it.
I tried using this strategy.
1. Remove all stamps
Aspose.Pdf.Kit.PdfAnnotationEditor editor = new Aspose.Pdf.Kit.PdfAnnotationEditor();
//bind input PDF file
editor.BindPdf(inputFile);

//delete all the annotations of type Stamp
editor.DeleteAnnotation(“Stamp”);

editor.Save(outputFile);

But the above code fails to remove the stamp I added before using the PDFFileStamp class.

2. Add the first stamp with opacity .5
aStamp.Opacity = .5f;
aStamp.SetOrigin(stamper.PageWidth * 6 / 10, stamper.PageHeight - 75);

3. Add the VOID text on top of the first stamp
aStamp.SetOrigin(stamper.PageWidth * 6 / 10, stamper.PageHeight - 75);

4. Add the new stamp below the first stamp
secondStamp.SetOrigin(stamper.PageWidth * 6 / 10, stamper.PageHeight - 150);


This works for me except the issues I mentioned above?
Please let me know.

Thanks!



Hi Sudheer,

I’m afraid, currently these two features are not supported; however, I have logged new feature requests as shown below:

PDFKITNET-18197 - Allow to specify stamp border
PDFKITNET-18199 - Allow to remove stamps

Our team will look into these requirements and you’ll be updated via this forum thread once they’re supported in our future version.

We’re sorry for the inconvenience.
Regards,