Q: We need to update an existing stamp in a PDF page and change the text on it. How can we do that using Qoppa’s Java PDF annotating component, jPDFNotes?

Q: You will need to remove the existing rubber stamp and create a new stamp with the same properties but different text.

The example below shows how to remove an existing rubber stamp and create a new stamp with the following text “My New Stamp” and add the new rubber stamp to the first page of a PDF document.

// get current stamp (assuming only one annotation on the first page)
RubberStamp currentStamp = (RubberStamp) pdfEditor.getDocument().getIPage(0).getAnnotations().get(0);     
// create a new rubber stamp with new text and same color       
RubberStamp newRubberstamp = pdfNotesBean.getMutableDocument().getAnnotationFactory().createRubberStamp("My New Text",currentStamp.getColor()); 
// copy all properties from current stamp to new stamp 
// remove current stamp 
pdfNotesBean.removeAnnotation(currentStamp, 0); 
// add new stamp 
pdfNotesBean.addAnnotation(newStamp, 0);