documentCapture.documentToStructure.promise(options)
The content in this help topic pertains to SuiteScript 2.1.
|
Method Description |
Asynchronously extracts content from a document. This method can return the text content, table content, and key-value pairs (fields) from the specified document located in the NetSuite File Cabinet. The content returned depends on the features you specify when you call this method (using the This method supports documents up to five pages in length. If you want to extract content from documents longer than five pages, you must submit an asynchronous extraction task using the N/task module. For an example, see Extract Content from a Document Asynchronously. This method supports PDF, JPG, PNG, and TIFF files. Encrypted files are not supported.
Note:
The parameters and errors thrown for this method are the same as those for documentCapture.documentToStructure(options). For more information about promises, see Promise Object. |
|
Returns |
|
|
Synchronous Version |
|
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.1 Script Types. |
|
Governance |
100 |
|
Module |
|
|
Since |
2025.2 |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/documentCapture Module Script Samples.
// Add additional code
...
documentCapture.documentToStructure.promise({
file: file.load("SuiteScripts/sample_invoice.pdf"),
documentType: documentCapture.DocumentType.INVOICE,
features: [
documentCapture.Feature.TEXT_EXTRACTION,
documentCapture.Feature.FIELD_EXTRACTION
]
}).then(function(result) {
// Work with the result
});
...
// Add additional code