Insert Example VB

This example demonstrates how to insert pages into a file.

Private Sub cmdInsert_Click()
    Dim strOrigFile, strInsertFile As String
    Dim lngPgCount As Long 
    'This is the displayed image into which we insert the page.
    ImgAdmin1.Image = "D:\image2\original.tif"
    'Because we will use the dialog box to pick the file to be inserted
    'we need to save the original file.
    strOrigFile = ImgAdmin1.Image 
    ImgAdmin1.DialogTitle = "Select the file you want to insert 
        into the displayed image"
    ImgAdmin1.ShowFileDialog OpenDlg
    strInsertFile = ImgAdmin1.Image 
    'Restore the original filename to the Image property because
    'the property must contain the destination file name.
    ImgAdmin1.Image = strOrigFile 
    'Insert 2 pages starting with page 1 of the source file,
    'which will be placed before page 3 in the original file. The
    'compression type of the source file will be retained since a
    'different compression type is not specified.
    ImgAdmin1.Insert strInsertFile, 1, 3, 2 
End Sub