←Select platform

Create(string,CreateDocumentOptions) Method

Summary

Creates a new empty document.

Syntax
C#
VB
C++
Java
public static LEADDocument Create( 
   string documentType, 
   CreateDocumentOptions options 
) 
Public Shared Function Create( 
   ByVal documentType As String, 
   ByVal options As CreateDocumentOptions 
) As LEADDocument 
public:  
   static LEADDocument^ Create( 
      String^ documentType, 
      CreateDocumentOptions^ options 
   ) 
public static Document create(String documentType, CreateDocumentOptions options) 

Parameters

documentType

Document type. Cannot be null.

options

Options to use when creating the document. Cannot be null.

Return Value

The newly created document.

Remarks

Use this method to create a new empty document. documentType controls the type of the document created and the following values are currently supported:

Value Description
"Raster" Creates a new Raster document. Requires the Leadtools.Document.Raster.dll assembly.
"Pdf" Creates a new PDF document. Requires the Leadtools.Document.Pdf.dll assembly.
"Virtual" Creates a new empty virtual document ready to be filled with pages from other documents. This is the equivalant of calling DocumentFactory.Create(CreateDocumentOptions)
Any other value Will throw an exception.

This method will add items with the key "Created", "Accessed" and "Modified" to Metadata with values equal to the current date and time. The newly created LEADDocument object will have an empty list of Pages. It can then be populated by the user.

The member of options are used as follows:

Member Description
Cache and UseCache Used to determine if the newly created document will be saved into the cache later.
CachePolicy
If caching is used: Copied to the newly created document and is used to determine when the document and its item are purged from the cache.
DocumentId

The ID to be used with the loaded document. When this value is null (the default), then the document factory will create a new unique ID using a (DocumentFactory.NewCacheId). If the value is not null, then it is assumed to be a user-defined ID and used as is. In either case, the value is set in the LEADDocument.DocumentId property of the newly created document.

User-defined IDs can be used when the system already has unique ID's associated with the documents to be viewer. The document factory will not check nor guarantee the uniqueness of these IDs.
MimeType
Copied as is into the newly created document MimeType member. This value can be null but it is recommended you set it to the MIME type of the document since it will be used when saving the document. Use one of the MIME types constants defined in the Constants class. In the case of virtual documents, this value can be left as null.

Example

For an example, refer to Create.

Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.