How can I export the “stamp annotation from image” to an image file?
I have a pdf which contains stamp annotions (in fact it's an image), I want to export all these kinds of images to file and get the x/y position.
I am new to pdf. Any idea or code will be appreciated.
[--- Edited on 2019/08/08 ---]
private void btnExtractAnnotaion_Click(object sender, EventArgs e) { PdfReader reader = new PdfReader(this.txtPdf.Text); PdfDictionary pageDict = reader.GetPageN(reader.NumberOfPages); PdfArray annotArray = pageDict.GetAsArray(PdfName.ANNOTS); PdfObject annot = null; Console.WriteLine("Annotation count:{0}", annotArray.Size); for (int i = 0; i < annotArray.Size; i++) { annot = annotArray.GetDirectObject(i); Console.WriteLine(annot.ToString()); //curAnnot = annotArray.GetAsDict(i); //Console.WriteLine(curAnnot.ToString()); bool btmp = annot.IsDictionary(); if (btmp) { PdfDictionary pdfDic = ((PdfDictionary)annot); PdfName stamp = pdfDic.GetAsName(PdfName.SUBTYPE); if (stamp.Equals(PdfName.STAMP)) { //PdfObject img = pdfDic.GetDirectObject(PdfName.RECT); // How Can I get the image(png, jpg...) of Stamp? } }