ImageGear Professional v18.2 > User Guide > Using ImageGear > Loading, Saving, and Acquiring Images > Updating a Document (Multi-Page File) |
Since a multi-page file is a complex thing, there are situations where your application will have to make complex modifications to the file (re-arranging the pages, inserting new pages, removing pages, etc.). If the document contains hundreds or thousands of pages, then SaveDocument Method can be a very expensive and time-consuming operation. For those cases, there is another mechanism for dealing with a multi-page file: OpenDocument Method.
When using OpenDocument Method, your application operates in 3 phases:
You cannot mix OpenDocument Method usage with LoadDocument Method or SaveDocument Method. This example uses a hard-coded filename. A real application would provide some mechanism for choosing the file to load (for example, a File-Chooser dialog - see Dialogs, below). |
Copy Code
|
|
---|---|
Dim document As IGDocument Dim file As IGIOFile Dim options as IGLoadOptions IGCoreCtl1.License.SetSolutionName "Accusoft" IGCoreCtl1.Result.NotificationMode = IG_ERR_NO_ACTION IGCoreCtl1.AssociateComponent IGFormatsCtl1.ComponentInterface Set file = IGFormatsCtl1.CreateObject(IG_FORMATS_OBJ_IOFILE) Set options = IGFormatsCtl1.CreateObject(IG_FORMATS_OBJ_LOADOPTIONS) file.FileName = "myfile.tif" ` Phase 1: create the IGDocument, associate it with a file, and load it Set document = IGCoreCtl1.CreateDocument(0) IGFormatsCtl1.OpenDocument document, file, 0 IGFormatsCtl1.ReadPagesToDocument document, 0, -1 ` Phase 2: update the document and synchronize the file . . (document modification logic not shown) . IGFormatsCtl1.UpdateDocument document ` Phase 3: unassociated the file - we're done IGFormatsCtl1.CloseDocument document, False |