show multipage tif in 1 viewer

Example requests & Code samples for GdPicture Toolkits.
Post Reply
bpabmeyer
Posts: 20
Joined: Tue Oct 07, 2008 4:32 pm

show multipage tif in 1 viewer

Post by bpabmeyer » Tue Oct 07, 2008 4:38 pm

I can't seem to figure out how to display multiple pages from 1 tif document in the same viewer using vb 2008. Is this possible?

As a side note what is the difference between GDPicturePro5 and GDPicturePro5S (Safe)?

Thanks.

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

Re: show multipage tif in 1 viewer

Post by Loïc » Wed Oct 08, 2008 2:22 pm

Hi,

Here a sample to draw all the page of a multipage tiff image on a new image which is displayed into a GdViewer object.


Code: Select all

Dim nTiffImage As Long
Dim nTiffImagePageCount As Long
Dim nHeightOfOnePage As Long
Dim nWidthOfOnePage As Long
Dim I As Long
Dim nCanvaHeight As Long
Dim nCanvaWidth As Long
Dim nCanvaImage As Long

Imaging1.TiffOpenMultiPageAsReadOnly (True)
nTiffImage = Imaging1.CreateImageFromFile("D:\projets\gdpicture\images de test\mainfile.tif")

Imaging1.SetNativeImage (nTiffImage)
nTiffImagePageCount = Imaging1.TiffGetPageCount(nTiffImage)
nHeightOfOnePage = Imaging1.GetHeight
nWidthOfOnePage = Imaging1.GetWidth
nCanvaHeight = nHeightOfOnePage * nTiffImagePageCount
nCanvaWidth = Imaging1.GetWidth
   
nCanvaImage = Imaging1.CreateNewImage(nCanvaWidth, nCanvaHeight, 24, White)

Imaging1.SetNativeImage (nCanvaImage)
For I = 1 To Imaging1.TiffGetPageCount(nTiffImage)
    Call Imaging1.TiffSelectPage(nTiffImage, I)
    Call Imaging1.DrawImage(nTiffImage, 0, (I - 1) * nHeightOfOnePage, nWidthOfOnePage, nHeightOfOnePage, InterpolationModeNearestNeighbor)
Next I

Imaging1.CloseImage (nTiffImage)

GdViewer1.SetNativeImage (nCanvaImage)

Best regards,

Loïc

bpabmeyer
Posts: 20
Joined: Tue Oct 07, 2008 4:32 pm

Re: show multipage tif in 1 viewer

Post by bpabmeyer » Wed Oct 08, 2008 9:36 pm

thanks for the code, it helped out tremendously for one of my pages, but i should have been a little more descriptive

i am using 2 viewers the first one to show an existing multipage tif document the second one to show another single or multipage tif document(s). i want to use the second viewer to add or delete pages to the first viewer, i also want to be able to grab and reorder pages in the first viewer. i understand this is quite a bit of stuff going on here but i am converting an existing process from vb6 to vb 2008. thanks again.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest