ImageGear Professional for Windows ActiveX
Loading/Saving a Document (Multi-Page File)

The following examples show how you might load all of the pages from a multi-page file into an IGDocument Object; first using LoadDocumentFromFile Method, second showing the equivalent LoadDocument Method, and third showing LoadDocument Method to obtain the pages over the Internet. Since these examples are only concerned with the loading and saving functions, they do not show the code that would have modified the images (thus necessitating the save processing). If your application does not modify the image in any way, then it will not need to include the "save" logic.

These examples:

LoadDocumentFromFile Example:

 
Copy Code
Dim document As IGDocument
IGCoreCtl1.License.SetSolutionName "Accusoft"
IGCoreCtl1.Result.NotificationMode = IG_ERR_NO_ACTION
IGCoreCtl1.AssociateComponent IGFormatsCtl1.ComponentInterface
Set document = IGCoreCtl1.CreateDocument(0)
IGFormatsCtl1.LoadDocumentFromFile document, "myfile.tif", 0,
0, -1
.
. (document modification logic not shown)
.
IGFormatsCtl1.SaveDocumentToFile page, "myfile.tif", 0, 0, -1,
IG_PAGESAVEMODE_OVERWRITE, IG_SAVE_UNKNOWN

LoadDocument Example:

 
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"
Set document = IGCoreCtl1.CreateDocument(0)
IGFormatsCtl1.LoadDocument document, file, 0, 0, -1, options
.
. (document modification logic not shown)
.
IGFormatsCtl1.SaveDocument page, file, 0, 0, -1,
IG_PAGESAVEMODE_OVERWRITE, IG_SAVE_UNKNOWN

LoadDocument from Internet Example:

 
Copy Code
Dim document As IGDocument
Dim url As IGIOURL
Dim options as IGLoadOptions
IGCoreCtl1.License.SetSolutionName "Accusoft"
IGCoreCtl1.Result.NotificationMode = IG_ERR_NO_ACTION
IGCoreCtl1.AssociateComponent IGFormatsCtl1.ComponentInterface
Set url = IGFormatsCtl1.CreateObject(IG_FORMATS_OBJ_IOURL)
Set options =
IGFormatsCtl1.CreateObject(IG_FORMATS_OBJ_LOADOPTIONS)
url.InetService = IG_INETSERV_HTTP
url.HostName = "www.accusoft.com"
url.URLPath = "rsc/ts/pr/9999/myfile.tif"
url.UserName = "Anonymous"
url.Password = ""
Set document = IGCoreCtl1.CreateDocument(0)
IGFormatsCtl1.LoadDocument document, url, 0, 0, -1, options
.
. (document modification logic not shown)
.
IGFormatsCtl1.SaveDocument page, url, 0, 0, -1,
IG_PAGESAVEMODE_OVERWRITE, IG_SAVE_UNKNOWN

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback