AddNewDocument

What it does

Adds a new document from an image file into a batch.

To create a document without an image, leave the file parameter empty (file.Name = "", file.Bytes = new bytes [0]).

A new document is created with the excludeFromAutomaticAssembling flag set to true. This flag indicates that the document has already been assembled, and the assembly settings specified for the batch type will not be applied to this document.

Wichtig! Newly added documents become accessible only after their images are pre-processed. Use the ProcessBatch method to initiate batch processing after adding new documents.

Hinweis. When anew document is added into the batch, the Id field of the corresponding object must not be empty.  

If you are adding PDF documents and want the program to use the text stored in their text layer, make sure that the Use PDF text layer instead of OCR option is selected for the project in which the documents will be processed (you can find this option on the Processing tab of the Page Properties dialog box).

Definition

int AddNewDocument( int sessionId, Document document, File file, bool excludeFromAutomaticAssembling, int previousItemId );

Parameters

Name Type Description
sessionId int The ID of the connection to the Application Server
document Document A description of the document that is being created
file File The file that contains the document image
excludeFromAutomaticAssembling bool

A flag that shows whether the document is excluded from document assembly or not:

  • True - the document has already been assembled and is not included in document assembly;
  • False - the document will be assembled according to the settings specified for the batch type.
previousItemId int

The ID explicitly specifying the position of the new document in the set:

  • -1 - the new document will be added at the end of the set
  • 0 - the new document will be added at the start of the set
  • Document ID - the new document will be added after the document with this ID
    Hinweis. A document with this ID must exist.

Hinweis. You can also use a POST request to add document image. For this, create a document with an empty file by this method (file.Name = "FileName", file.Bytes = new bytes [0]). Then execute a POST request with the following parameters:

  • Action = Save
  • objectType = 0
  • objectId = documentId, where documentId document ID returned by the AddNewDocument method
  • version = 0
  • streamName = "FileName", where FileName is a name of the file specified when calling the AddNewDocument method

Returned value

Type Description
int The ID of the created document

12.04.2024 18:16:01

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.