Load multiple files

Discussions about document viewing.
Post Reply
PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Load multiple files

Post by PQSIK » Sat Apr 23, 2011 11:11 pm

Hi there,

can some show me how to load multiple tiff files into a viewer with and thumbnail viewer.

Thanks

pqsik

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: Load multiple files

Post by PQSIK » Mon Apr 25, 2011 1:57 am

Hi there,
I'm trying this but I'm not getting any images in the thumbnailEx1

Code: Select all

dim LstImage as new List(of Integer)
For each file in FileCollection
  LstImage.add(gdp.CreateGdPictureImageFromFile(file.name))
Next

For Each Item As Integer In LstImage
      ThumbnailEx1.LoadFromGdPictureImage(Item)
Next


Now I have to link the LstImage to a gdpicture viewer.
Do I have to loop the LstImage and add the images to a thumbnail viewer?

Thanks

pqsik

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: Load multiple files

Post by PQSIK » Tue Apr 26, 2011 1:22 am

I'm still looking for help with this.

Has anyone loaded multiple tiff files into a GdPictureImaging and showing them in a GdPicture thumbnail viewer and GdPicture viewer.

Can it be done?

Thanks

pqsik

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Load multiple files

Post by Loïc » Tue Apr 26, 2011 9:32 am

Hi,

Just use the AddItemFromGdPictureImage method of the ThumbnailEx class.

Kind regards,

Loïc

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: Load multiple files

Post by PQSIK » Tue Apr 26, 2011 9:09 pm

Thank for the reply Loic,

I tried that, but if the tiff file has multiple pages I don't see them in the thumbnail viewer Just one label, no image.

I can use the viewers pages/frames goto next to see them.

Do I have to get each tiff page and add to another GdPictureImaging and loop into the thumbnail viewer or I'm I taking this to far.

pqsik

PQSIK
Posts: 50
Joined: Wed Oct 21, 2009 7:26 pm

Re: Load multiple files

Post by PQSIK » Wed Apr 27, 2011 4:12 am

I have it working now, need to make sure there is no memory leaks.

Code: Select all

gdp.SetLicenseNumber(SharedObject.L)
        Dim ThisPath As String = DataLoader.LoadSettings().CertificateLocation
        Dim intImage As Integer = 0
        Dim Pos As Integer = 0
        For Each item As SMProGageCertificate In DataLoader.LoadGageCertificate(ThisGageID)
            If FolderHelper.DoesFileExist(Path.Combine(ThisPath, item.CertificateName)) Then
                gdp.TiffOpenMultiPageForWrite(False)
                intImage = gdp.CreateGdPictureImageFromFile(Path.Combine(ThisPath, item.CertificateName))
                Dim TiffOutputID As Integer = 0
                If gdp.TiffIsMultiPage(intImage) Then
                    Dim PageCount As Integer = gdp.TiffGetPageCount(intImage)
                    For j As Integer = 1 To PageCount
                        gdp.TiffSelectPage(intImage, j)
                        TiffOutputID = gdp.CreateClonedGdPictureImage(intImage)
                        LstImage.Add(New ValuePair(String.Format("Multiple tiff {0} of {1} {2} {3}", j, PageCount, vbCrLf, item.CertificateName), gdp.CreateClonedGdPictureImage(TiffOutputID), Pos))
                        gdp.ReleaseGdPictureImage(TiffOutputID)
                        Pos += 1
                    Next
                Else
                    TiffOutputID = gdp.CreateClonedGdPictureImage(intImage)
                    LstImage.Add(New ValuePair(item.CertificateName, gdp.CreateClonedGdPictureImage(TiffOutputID), Pos))
                    gdp.ReleaseGdPictureImage(TiffOutputID)
                    Pos += 1
                End If
            End If
            gdp.ReleaseGdPictureImage(intImage)
        Next

        Try
            ThumbnailEx1.LoadFromGdPictureImage(-1)
        Catch ex As Exception
            If ThumbnailEx1.AllItemsLoaded Then
                For Each Item As ValuePair In LstImage
                    ThumbnailEx1.AddItemFromGdPictureImage(Item.ItemValueInt)
                    ThumbnailEx1.SetItemText(Item.ItemPosition, Item.DisplayText)
                Next
            End If
        End Try

and

Private Sub frmImage_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        For Each Item As ValuePair In LstImage
            gdp.ReleaseGdPictureImage(Item.ItemValueInt)
        Next
        ThumbnailEx1.ClearAllItems()
    End Sub



Thank

pqsik

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests