Upload multitiff to ftp

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
flealg
Posts: 2
Joined: Fri May 21, 2010 9:54 pm

Upload multitiff to ftp

Post by flealg » Fri May 21, 2010 10:19 pm

Hi,
I am test the product

I have my multitiff "C:\Test.tif" with two images. I make with
For i = 0 To VSTwain1.NumImages - 1
VSTwain1.SaveImage(i, saveFileDialog1.FileName)
Next

I looking for upload "C:\Test.tif" to ftp

This code only upload one image.
ftpUpload1.AddFile(ftpFileName.Text, mainForm.VSTwain1.GetImageAsStream(mainForm._currentImageIndex, ImageFileFormat.TIFF))

Thanks
Fernando

Alex
Site Admin
Posts: 1464
Joined: Thu Jul 10, 2008 2:21 pm

Re: Upload multitiff to ftp

Post by Alex » Sat May 22, 2010 10:45 am

Hello Fernando,

VSTwain.GetImageAsStream method returns the single image acquired from scanner as stream.

You can go by 2 ways if you want to upload multipage TIFF file to FTP server:
1. Save multipage TIFF file to disk and upload it, here is a snippet of code:

Code: Select all

For i = 0 To VSTwain1.NumImages - 1
    VSTwain1.SaveImage(i, saveFileDialog1.FileName)
Next

Dim fileStream As FileStream = File.Open(saveFileDialog1.FileName, FileMode.Open, FileAccess.Read)
ftpUpload1.AddFile(ftpFileName.Text, fileStream)
2. Save multipage TIFF file to memory and upload it, here is a snippet of code:

Code: Select all

Dim memoryStream As MemoryStream = VSTwain1.GetImageAsStream(0, ImageFileFormat.TIFF)
Dim i As Integer
For i = 1 To VSTwain1.NumImages - 1
    VSTwain1.SaveImageToStream(i, memoryStream, ImageFileFormat.TIFF)
Next i

ftpUpload1.AddFile(ftpFileName.Text, memoryStream)
Best regards, Alexander

flealg
Posts: 2
Joined: Fri May 21, 2010 9:54 pm

Re: Upload multitiff to ftp

Post by flealg » Tue Jun 01, 2010 4:21 pm

Yeah!,
Now it's working. :P
http://www.captura-digital.com/images/s ... umento.png

Thanks you
Fernando

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests