Reference documentation and code samples for the Google Cloud Document Ai V1 Client class Document.
Document represents the canonical document resource in Document AI. It is an
interchange format that provides insights into documents and allows for
collaboration between users and Document AI to iterate and optimize for
quality.
Generated from protobuf messagegoogle.cloud.documentai.v1.Document
Namespace
Google \ Cloud \ DocumentAI \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ uri
string
Optional. Currently supports Google Cloud Storage URI of the formgs://bucket_name/object_name. Object versioning is not supported. For more information, refer toGoogle Cloud Storage Request URIs.
↳ content
string
Optional. Inline document content, represented as a stream of bytes. Note: As with allbytesfields, protobuffers use a pure binary representation, whereas JSON representations use base64.
↳ docid
string
Optional. An internal identifier for document. Should be loggable (no PII).
Placeholder. A list of text corrections made toDocument.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.
Placeholder. A list of text corrections made toDocument.text. This is usually
used for annotating corrections to OCR mistakes. Text changes for a given
revision may not overlap with each other.
Placeholder. A list of text corrections made toDocument.text. This is usually
used for annotating corrections to OCR mistakes. Text changes for a given
revision may not overlap with each other.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Document Ai V1 Client - Class Document (2.3.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.3.0 (latest)](/php/docs/reference/cloud-document-ai/latest/V1.Document)\n- [2.2.2](/php/docs/reference/cloud-document-ai/2.2.2/V1.Document)\n- [2.1.3](/php/docs/reference/cloud-document-ai/2.1.3/V1.Document)\n- [2.0.0](/php/docs/reference/cloud-document-ai/2.0.0/V1.Document)\n- [1.14.0](/php/docs/reference/cloud-document-ai/1.14.0/V1.Document)\n- [1.13.1](/php/docs/reference/cloud-document-ai/1.13.1/V1.Document)\n- [1.12.2](/php/docs/reference/cloud-document-ai/1.12.2/V1.Document)\n- [1.9.0](/php/docs/reference/cloud-document-ai/1.9.0/V1.Document)\n- [1.8.2](/php/docs/reference/cloud-document-ai/1.8.2/V1.Document)\n- [1.7.0](/php/docs/reference/cloud-document-ai/1.7.0/V1.Document)\n- [1.6.0](/php/docs/reference/cloud-document-ai/1.6.0/V1.Document)\n- [1.5.0](/php/docs/reference/cloud-document-ai/1.5.0/V1.Document)\n- [1.4.0](/php/docs/reference/cloud-document-ai/1.4.0/V1.Document)\n- [1.3.0](/php/docs/reference/cloud-document-ai/1.3.0/V1.Document)\n- [1.2.2](/php/docs/reference/cloud-document-ai/1.2.2/V1.Document)\n- [1.1.1](/php/docs/reference/cloud-document-ai/1.1.1/V1.Document)\n- [1.0.1](/php/docs/reference/cloud-document-ai/1.0.1/V1.Document) \nReference documentation and code samples for the Google Cloud Document Ai V1 Client class Document.\n\nDocument represents the canonical document resource in Document AI. It is an\ninterchange format that provides insights into documents and allows for\ncollaboration between users and Document AI to iterate and optimize for\nquality.\n\nGenerated from protobuf message `google.cloud.documentai.v1.Document`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ DocumentAI \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getUri\n\nOptional. Currently supports Google Cloud Storage URI of the form\n`gs://bucket_name/object_name`. Object versioning is not supported.\n\nFor more information, refer to [Google Cloud Storage Request\nURIs](https://cloud.google.com/storage/docs/reference-uris).\n\n### hasUri\n\n### setUri\n\nOptional. Currently supports Google Cloud Storage URI of the form\n`gs://bucket_name/object_name`. Object versioning is not supported.\n\nFor more information, refer to [Google Cloud Storage Request\nURIs](https://cloud.google.com/storage/docs/reference-uris).\n\n### getContent\n\nOptional. Inline document content, represented as a stream of bytes.\n\nNote: As with all `bytes` fields, protobuffers use a pure binary\nrepresentation, whereas JSON representations use base64.\n\n### hasContent\n\n### setContent\n\nOptional. Inline document content, represented as a stream of bytes.\n\nNote: As with all `bytes` fields, protobuffers use a pure binary\nrepresentation, whereas JSON representations use base64.\n\n### getDocid\n\nOptional. An internal identifier for document. Should be loggable (no PII).\n\n### setDocid\n\nOptional. An internal identifier for document. Should be loggable (no PII).\n\n### getMimeType\n\nAn IANA published [media type (MIME\ntype)](https://www.iana.org/assignments/media-types/media-types.xhtml).\n\n### setMimeType\n\nAn IANA published [media type (MIME\ntype)](https://www.iana.org/assignments/media-types/media-types.xhtml).\n\n### getText\n\nOptional. UTF-8 encoded text in reading order from the document.\n\n### setText\n\nOptional. UTF-8 encoded text in reading order from the document.\n\n### getTextStyles\n\nStyles for the [Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__).\n\n### setTextStyles\n\nStyles for the [Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__).\n\n### getPages\n\nVisual page layout for the [Document](/php/docs/reference/cloud-document-ai/latest/V1.Document).\n\n### setPages\n\nVisual page layout for the [Document](/php/docs/reference/cloud-document-ai/latest/V1.Document).\n\n### getEntities\n\nA list of entities detected on\n[Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__). For document\nshards, entities in this list may cross shard boundaries.\n\n### setEntities\n\nA list of entities detected on\n[Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__). For document\nshards, entities in this list may cross shard boundaries.\n\n### getEntityRelations\n\nPlaceholder. Relationship among\n[Document.entities](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getEntities__).\n\n### setEntityRelations\n\nPlaceholder. Relationship among\n[Document.entities](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getEntities__).\n\n### getTextChanges\n\nPlaceholder. A list of text corrections made to\n[Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__). This is usually\nused for annotating corrections to OCR mistakes. Text changes for a given\nrevision may not overlap with each other.\n\n### setTextChanges\n\nPlaceholder. A list of text corrections made to\n[Document.text](/php/docs/reference/cloud-document-ai/latest/V1.Document#_Google_Cloud_DocumentAI_V1_Document__getText__). This is usually\nused for annotating corrections to OCR mistakes. Text changes for a given\nrevision may not overlap with each other.\n\n### getShardInfo\n\nInformation about the sharding if this document is sharded part of a larger\ndocument. If the document is not sharded, this message is not specified.\n\n### hasShardInfo\n\n### clearShardInfo\n\n### setShardInfo\n\nInformation about the sharding if this document is sharded part of a larger\ndocument. If the document is not sharded, this message is not specified.\n\n### getError\n\nAny error that occurred while processing this document.\n\n### hasError\n\n### clearError\n\n### setError\n\nAny error that occurred while processing this document.\n\n### getRevisions\n\nPlaceholder. Revision history of this document.\n\n### setRevisions\n\nPlaceholder. Revision history of this document.\n\n### getDocumentLayout\n\nParsed layout of the document.\n\n### hasDocumentLayout\n\n### clearDocumentLayout\n\n### setDocumentLayout\n\nParsed layout of the document.\n\n### getChunkedDocument\n\nDocument chunked based on chunking config.\n\n### hasChunkedDocument\n\n### clearChunkedDocument\n\n### setChunkedDocument\n\nDocument chunked based on chunking config.\n\n### getSource"]]