←Select platform

Create(string,CreateDocumentOptions) Method

Summary

Creates a new empty document.

Syntax

C#
VB
Java
C++
public static Document Create( 
   string documentType, 
   CreateDocumentOptions options 
) 
Public Shared Function Create( 
   ByVal documentType As String, 
   ByVal options As CreateDocumentOptions 
) As Document 
public:  
   static Document^ 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.Documents.Raster.dll assembly.
"Pdf" Creates a new PDF document. Requires the Leadtools.Documents.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 Document 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 null (the default), then the document factory will create a new unique ID using a GUID generator. 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 Document.DocumentId property of the newly created document.

User-defined IDs can be used when the system already have unique ID's associated with the documents to be viewer. The document factory will not check nor guarantee the uniqness of these IDs.
MimeType Copied as is into the newly created document MimeType member. This value can be null but it is recommend 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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Documents Assembly