Forum 'VintaSoft Twain .NET SDK Discussions'

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

Board index < VintaSoft Twain < VintaSoft Twain .NET SDK Discussions

Login

Upload multitiff to ftp



Upload multitiff to ftp

Post by flealg »

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


Re: Upload multitiff to ftp

Post by Alex »

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:
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:
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


Re: Upload multitiff to ftp

Post by flealg »

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

Thanks you
Fernando


Page 1 from 1: 1