Identify Stamped Pages in a PDF

Hi,

I am using PDFTron to try and determine if a page has been stamped but have not been able to find a method to do this.

Has anyone done this in Java, and if so, would you be kind enough to post sample code

Thanks, in advance

Neil

If you stamped using our Stamper API, then there is a method called Stamper.hasStamps()

Otherwise, there is no general way to determine if a page is “stamped”.

Could you could provide more details on what you mean by “stamped”?

Hi,

Thanks for your response.

We have a QA process that allows pages within documents to be stamped with a ‘Return’ or ‘Destroy’ stamp that are used in the printing process to route.

We use Adobe Acrobat Stamp tool to stamp the documents, which add a bitmap to the stamped page

Hope this is a bit clearer, but this is all new to me, so not sure what the right questions to be asked

Thanks for your help

Neil

I just took a look at the what Adobe puts in the PDF for “Approved” and “For Comment” stamps. Based on what I saw the following is what you want to do.

Below is python code that will go through an entire document and print out information on all the annotations, including the Subj entry for the ones you are interested in.

`
def AnnotationHighLevelAPI(doc):

The following code snippet traverses all annotations in the document

print(“Traversing all annotations in the document…”)
page_num = 1
itr = doc.GetPageIterator()

while itr.HasNext():
print("Page " + str(page_num) + ": ")
page_num = page_num + 1
page = itr.Current()
num_annots = page.GetNumAnnots()
i = 0
while i < num_annots:
annot = page.GetAnnot(i)
if not annot.IsValid():
continue
print("Annot Type: " + annot.GetSDFObj().Get(“Subtype”).Value().GetName())
type = annot.GetType()
if type == Annot.e_Stamp:

Annot <= Annots.Markup <= Annots.RubberStamp

stamp = RubberStamp(annot)
print("Subject: " + stamp.GetSubject()) # I think this will say “Return” or “Destroy” in your case
i = i + 1
itr.Next()

`

Or you can start with the AnnotationTest sample.
http://www.pdftron.com/pdfnet/samplecode/AnnotationTest.py.html
And modify the AnnotationHighLevelAPI method to match above, or simply use this in your existing code.