Google Cloud Document Ai V1 Client - Class Document (1.0.1)

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 message google.cloud.documentai.v1.Document

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ uri string

Optional. Currently supports Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. See Google Cloud Storage Request URIs for more info.

↳ content string

Optional. Inline document content, represented as a stream of bytes. Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

↳ mime_type string

An IANA published MIME type (also referred to as media type). For more information, see https://www.iana.org/assignments/media-types/media-types.xhtml.

↳ text string

Optional. UTF-8 encoded text in reading order from the document.

↳ text_styles array<Google\Cloud\DocumentAI\V1\Document\Style>

Placeholder. Styles for the Document.text.

↳ pages array<Google\Cloud\DocumentAI\V1\Document\Page>

Visual page layout for the Document.

↳ entities array<Google\Cloud\DocumentAI\V1\Document\Entity>

A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries.

↳ entity_relations array<Google\Cloud\DocumentAI\V1\Document\EntityRelation>

Placeholder. Relationship among Document.entities.

↳ text_changes array<Google\Cloud\DocumentAI\V1\Document\TextChange>

Placeholder. A list of text corrections made to Document.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.

↳ shard_info Google\Cloud\DocumentAI\V1\Document\ShardInfo

Information about the sharding if this document is sharded part of a larger document. If the document is not sharded, this message is not specified.

↳ error Google\Rpc\Status

Any error that occurred while processing this document.

↳ revisions array<Google\Cloud\DocumentAI\V1\Document\Revision>

Placeholder. Revision history of this document.

getUri

Optional. Currently supports Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported.

See Google Cloud Storage Request URIs for more info.

Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
string

hasUri

setUri

Optional. Currently supports Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported.

See Google Cloud Storage Request URIs for more info.

Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getContent

Optional. Inline document content, represented as a stream of bytes.

Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
string

hasContent

setContent

Optional. Inline document content, represented as a stream of bytes.

Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

Generated from protobuf field bytes content = 2 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getMimeType

An IANA published MIME type (also referred to as media type). For more information, see https://www.iana.org/assignments/media-types/media-types.xhtml.

Generated from protobuf field string mime_type = 3;

Returns
TypeDescription
string

setMimeType

An IANA published MIME type (also referred to as media type). For more information, see https://www.iana.org/assignments/media-types/media-types.xhtml.

Generated from protobuf field string mime_type = 3;

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getText

Optional. UTF-8 encoded text in reading order from the document.

Generated from protobuf field string text = 4 [(.google.api.field_behavior) = OPTIONAL];

Returns
TypeDescription
string

setText

Optional. UTF-8 encoded text in reading order from the document.

Generated from protobuf field string text = 4 [(.google.api.field_behavior) = OPTIONAL];

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getTextStyles

Placeholder. Styles for the Document.text.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Style text_styles = 5;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setTextStyles

Placeholder. Styles for the Document.text.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Style text_styles = 5;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\Style>
Returns
TypeDescription
$this

getPages

Visual page layout for the Document.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page pages = 6;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setPages

Visual page layout for the Document.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Page pages = 6;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\Page>
Returns
TypeDescription
$this

getEntities

A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity entities = 7;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setEntities

A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Entity entities = 7;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\Entity>
Returns
TypeDescription
$this

getEntityRelations

Placeholder. Relationship among Document.entities.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setEntityRelations

Placeholder. Relationship among Document.entities.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.EntityRelation entity_relations = 8;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\EntityRelation>
Returns
TypeDescription
$this

getTextChanges

Placeholder. A list of text corrections made to Document.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setTextChanges

Placeholder. A list of text corrections made to Document.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.TextChange text_changes = 14;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\TextChange>
Returns
TypeDescription
$this

getShardInfo

Information about the sharding if this document is sharded part of a larger document. If the document is not sharded, this message is not specified.

Generated from protobuf field .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9;

Returns
TypeDescription
Google\Cloud\DocumentAI\V1\Document\ShardInfo|null

hasShardInfo

clearShardInfo

setShardInfo

Information about the sharding if this document is sharded part of a larger document. If the document is not sharded, this message is not specified.

Generated from protobuf field .google.cloud.documentai.v1.Document.ShardInfo shard_info = 9;

Parameter
NameDescription
var Google\Cloud\DocumentAI\V1\Document\ShardInfo
Returns
TypeDescription
$this

getError

Any error that occurred while processing this document.

Generated from protobuf field .google.rpc.Status error = 10;

Returns
TypeDescription
Google\Rpc\Status|null

hasError

clearError

setError

Any error that occurred while processing this document.

Generated from protobuf field .google.rpc.Status error = 10;

Parameter
NameDescription
var Google\Rpc\Status
Returns
TypeDescription
$this

getRevisions

Placeholder. Revision history of this document.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Revision revisions = 13;

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setRevisions

Placeholder. Revision history of this document.

Generated from protobuf field repeated .google.cloud.documentai.v1.Document.Revision revisions = 13;

Parameter
NameDescription
var array<Google\Cloud\DocumentAI\V1\Document\Revision>
Returns
TypeDescription
$this

getSource

Returns
TypeDescription
string