# Search for Barcode e-Signatures This article explains how to search for barcode electronic signatures within document pages using GroupDocs.Signature for Python via .NET API [GroupDocs.Signature](https://products.groupdocs.com/signature/python-net) provides the ability to search for barcode signatures in documents. Barcode signatures can be used to store various types of information in a compact format. ## What is a Barcode Signature? A barcode signature is a visual representation of data that can be scanned and read by machines. It typically consists of parallel black lines and white spaces of varying widths. Barcodes are commonly used for: - Product identification - Inventory tracking - Document verification - Data encoding ## How to Search for Barcode Signatures The [Signature](https://reference.groupdocs.com/signature/python-net/groupdocs.signature/signature/) class provides the [search](https://reference.groupdocs.com/signature/python-net/groupdocs.signature/signature/search/) method which allows you to search for barcode signatures in documents. Here's how to use it: 1. Create a new instance of the [Signature](https://reference.groupdocs.com/signature/python-net/groupdocs.signature/signature/) class and pass the source document path as a parameter. 2. Instantiate the [BarcodeSearchOptions](https://reference.groupdocs.com/signature/python-net/groupdocs.signature.options/barcodesearchoptions/) object with the required options. 3. Call the [search](https://reference.groupdocs.com/signature/python-net/groupdocs.signature/signature/search/) method of the [Signature](https://reference.groupdocs.com/signature/python-net/groupdocs.signature/signature/) class instance and pass a list with the [BarcodeSearchOptions](https://reference.groupdocs.com/signature/python-net/groupdocs.signature.options/barcodesearchoptions/) to it. 4. Process the search results: the `signatures` property of the returned [SearchResult](https://reference.groupdocs.com/signature/python-net/groupdocs.signature.domain/searchresult/) holds the found [BarcodeSignature](https://reference.groupdocs.com/signature/python-net/groupdocs.signature.domain/barcodesignature/) objects. Here's an example of how to search for barcode signatures in a document: {{< tabs "search_barcodes" >}} {{< tab "Python" >}} ```python from groupdocs.signature import Signature from groupdocs.signature.options import BarcodeSearchOptions def search_barcodes(): with Signature("signed.pdf") as signature: # Search all pages of the document for barcode signatures result = signature.search([BarcodeSearchOptions()]) print(f"Found {len(result.signatures)} barcode signature(s)") for barcode in result.signatures: print(f"Page {barcode.page_number}: {barcode.encode_type.type_name} barcode '{barcode.text}' " f"at ({barcode.left}, {barcode.top}), size {barcode.width}x{barcode.height}") if __name__ == "__main__": search_barcodes() ``` {{< /tab >}} {{< tab "signed.pdf" >}} {{< tab-text >}} `signed.pdf` is the sample file used in this example. Click [here](https://docs.groupdocs.com/signature/python-net/_sample_files/developer-guide/basic-usage/search-for-electronic-signatures-in-document/search-for-barcode-e-signatures/signed.pdf) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "search-barcodes.txt" >}} ```text Found 2 barcode signature(s) Page 1: Code128 barcode '123456789012' at (400, 375), size 170x45 Page 1: Code39 barcode 'JS-2026' at (400, 430), size 170x45 ``` [Download full output](https://docs.groupdocs.com/signature/python-net/_output_files/developer-guide/basic-usage/search-for-electronic-signatures-in-document/search-for-barcode-e-signatures/search_barcodes/search-barcodes.txt) {{< /tab >}} {{< /tabs >}} ## Advanced Search Options The [BarcodeSearchOptions](https://reference.groupdocs.com/signature/python-net/groupdocs.signature.options/barcodesearchoptions/) class provides properties to narrow the search: - `encode_type` returns only barcodes of the given type, for example `BarcodeTypes.CODE128`; - `text` and `match_type` return only barcodes whose text matches; - `all_pages` and `page_number` search a single page instead of the whole document (page numbers start at 1); - `return_content` and `return_content_type` also return the barcode image. {{< tabs "search_barcodes_with_filters" >}} {{< tab "Python" >}} ```python from groupdocs.signature import Signature from groupdocs.signature.domain import BarcodeTypes, TextMatchType from groupdocs.signature.options import BarcodeSearchOptions def search_barcodes_with_filters(): with Signature("signed.pdf") as signature: options = BarcodeSearchOptions() # Search the first page only options.all_pages = False options.page_number = 1 # Return only Code 128 barcodes whose text starts with "1234" options.encode_type = BarcodeTypes.CODE128 options.text = "1234" options.match_type = TextMatchType.STARTS_WITH result = signature.search([options]) print(f"Found {len(result.signatures)} matching barcode signature(s)") for barcode in result.signatures: print(f"Page {barcode.page_number}: {barcode.encode_type.type_name} barcode '{barcode.text}'") if __name__ == "__main__": search_barcodes_with_filters() ``` {{< /tab >}} {{< tab "signed.pdf" >}} {{< tab-text >}} `signed.pdf` is the sample file used in this example. Click [here](https://docs.groupdocs.com/signature/python-net/_sample_files/developer-guide/basic-usage/search-for-electronic-signatures-in-document/search-for-barcode-e-signatures/signed.pdf) to download it. {{< /tab-text >}} {{< /tab >}} {{< tab "search-barcodes-with-filters.txt" >}} ```text Found 1 matching barcode signature(s) Page 1: Code128 barcode '123456789012' ``` [Download full output](https://docs.groupdocs.com/signature/python-net/_output_files/developer-guide/basic-usage/search-for-electronic-signatures-in-document/search-for-barcode-e-signatures/search_barcodes_with_filters/search-barcodes-with-filters.txt) {{< /tab >}} {{< /tabs >}} ## More Resources ### GitHub Examples You may easily run the code above and see the feature in action in our GitHub examples: * [GroupDocs.Signature for Python via .NET examples](https://github.com/groupdocs-signature/GroupDocs.Signature-for-Python-via-.NET) ### Free Online Apps Along with the full-featured Python library, we provide simple but powerful free online apps. To sign PDF, Word, Excel, PowerPoint, and other documents you can use the online apps from the **[GroupDocs.Signature App Product Family](https://products.groupdocs.app/signature/family)**.