Guide for VB.NET
Core Document Formats
Get to Start - Create, Load, Save
Additional Features

VB.NET TIFF - Start to Create, Load & Save TIFF

VB.NET Sample Codes to Create, Load & Save Multi-page TIFF in .NET Project

VB.NET
Home > .NET Imaging SDK > VB.NET > Get Started with TIFF

"This online guide content is Out Dated!
    Please get the latest XDoc.Tiff C# Developer Guide here.
"

In general, a VB.NET TIFF processing & editing application will start with loading or creating TIFF document and end with saving TIFF file. Thus, this VB.NET online tutorial page will offer developers the APIs and demo codes on following TIFF manipulating applications.
Related .net document control helps:
asp.net annotate pdf control: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
asp.net view text file: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net dicom viewer: ASP.NET Dicom Document Viewer Control: view, annotate dicom imaging files online in ASP.NET
asp.net tiff viewer control: ASP.NET Tiff Viewer: view, annotate multipage Tiff images in ASP.NET MVC, WebForms using C# Control
asp.net document viewer control: EdgeDoc:ASP.NET Document Viewer C# Control: Open, view, annotate, redact, convert documents online in C#, VB.NET, AS...
asp.net edit pdf page: ASP.NET PDF Pages Edit Control: add, remove, sort, replace PDF pages online using C#
asp.net edit pdf text color: ASP.NET PDF Text Edit Control: online edit PDF text content using C# ASP.NET
  • What VB.NET APIs and demo codes are offered to create standard TIFF document file?
  • What VB.NET APIs and demo codes are used to load TIFF file from web or local file path?
  • What VB.NET APIs and sample codes are provided to save TIFF file?
Before giving you detailed VB.NET sample tutorials on how to get started with TIFF document imaging, we will illustrate two programming classes that will be used in following TIFF creating, loading and saving applications.
  • TIFFDocument: within the whole VB.NET TIFF reading control SDK, an in-memory TIFF document will be represented as one TIFFDocument object. To put it in another way, this TIFFDocument programming class is used as a high-level model of TIFF document file in this VB.NET class application.
  • TIFFPage: As for the pages contained in TIFFDocument instance, our VB.NET TIFF processor control add-on, contained in RasterEdge .NET Imaging SDK, uses this TIFFPage class to display them.
Create TIFF File
Compatible with .NET Framework 2.0, 3.0, 3.5, 4.0 & 4.5, this VB.NET TIFF editing & processing control add-on allows developers to create an empty TIFF file with desired number of pages or generate a .tif document file from existing image source.

VB.NET APIs

Using following VB.NET APIs, developers can easily create & generate desired and standard TIFF document file.
Private Sub New(pageNum As Integer)
End Sub
TIFFDocument(List < REImage > imagesource)

VB.NET Demo Code

There are two snippets of VB.NET sample codes, both of which can be used to create TIFF document file. Using the first VB.NET demo code, developers can generate a new TIFF file with blank pages and the number of created TIFF pages can be accurately defined.
Public Function CreateEmptyTIFFDocumentDemo() As TIFFDocument
Return New TIFFDocument(3)
End Function
Using the VB.NET sample code below, programmers can easily create a TIFF file from existing image source. For example, if there is a folder which contains several image files, then you can quickly create a multi-page TIFF file with these image files using following VB.NET code.
''' <summary>
''' Create TIFF document from an image source
''' </summary>
''' <param name="images"></param>
''' <returns></returns>
Public Function CreateImageOnlyTiffDocumentDemo(images As List(Of REImage)) As TIFFDocument
Return New TIFFDocument(images)
End Function
Load TIFF File
From this section, you will find the answer on how to load existing TIFF file from web server or PC files into your own VB.NET class application.

VB.NET APIs

Here we divide the VB.NET APIs into two categories. One is used to load TIFF file from local files and the other is to load TIFF document from web stream.
Private Sub New(filePath As [String])
End Sub
Private Sub New(s As Stream)
End Sub
Private Sub New(stream As MemoryStream)
End Sub
Private Function DecodeDocument(ioMgr As FileIOMgr) As BaseDocument Implements TIFDecoder.DecodeDocument
End Function

VB.NET Demo Code

Accordingly, two VB.NET demo codes are listed here to help developers decode TIFF document file from memory stream & .tif file format into VB.NET project.
''' <summary>
''' Load a TIFF document from file path
''' </summary>
''' <param name="filePath"></param>
''' <returns></returns>
Public Function LoadTIFFDocumentFromFileDemo(filePath As [String]) As TIFFDocument
Dim doc As TIFFDocument = DirectCast(REFile.OpenDocumentFile(filePath, New TIFDecoder()), TIFFDocument)

'or you can use
'return new TIFFDocument(filePath);
End Function
''' <summary>
''' Load a TIFF Document from stream
''' </summary>
''' <returns></returns>
Public Function LoadTIFFDocumentFromStreamDemo(s As Stream) As TIFFDocument
Dim buffer As Byte() = New Byte(s.Length - 1) {}

Dim ms As New MemoryStream()
s.Read(buffer, 0, CInt(s.Length))
ms.Write(buffer, 0, CInt(s.Length))
Dim test As New TIFDecoder()
Return DirectCast(test.DecodeDocument(New FileIOMgr(ms)), TIFFDocument)

' or
'return new TIFFDocument(s);
End Function
Note: after you load TIFF document file into target VB.NET class application, do you want to know how many pages this TIFF file contains? If yes, you may use following VB.NET API and sample code on counting the number of TIFF pages.
Private Function GetPageCount() As Integer Implements TIFFDocument.GetPageCount
End Function
Public Function GetPageCountDemo(filePath As [String]) As Integer
Dim doc As TIFFDocument = DirectCast(REFile.OpenDocumentFile(filePath, New TIFDecoder()), TIFFDocument)

' or
' TIFFDocument doc = new TIFFDocument(filePath);

Return doc.GetPageCount()
End Function
Save TIFF File
After you decode and edit the TIFF document file, you may probably save and re-encode processed TIFF file to web server or PC file. And here we will guide you how to finish the VB.NET TIFF saving tasks.

VB.NET APIs

Private Sub Save(filePath As [String]) Implements TIFFDocument.Save
End Sub
Private Sub Save(s As Stream) Implements TIFFDocument.Save
End Sub
Private Sub EncodeDocument(doc As BaseDocument, fileIoMgr As FileIOMgr) Implements TIFEncoder.EncodeDocument
End Sub

VB.NET Demo Code

You will find there are two snippets of VB.NET sample codes here. Using the first VB.NET demo code, you can easily save source TIFF file to desired file path in the form of .tif file format. Using the second VB.NET sample code, you can re-encode target TIFF file in the form of memory stream for web usage.
''' <summary>
''' Save TIFF document to file
''' </summary>
''' <param name="doc"></param>
''' <param name="filePath"></param>
Public Sub SaveTIFFDocumentoFileDemo(doc As TIFFDocument, filePath As [String])

REFile.SaveDocumentFile(doc, filePath, New TIFEncoder())

'or
'doc.Save(filePath);
End Sub
''' <summary>
''' Save TIFF document to stream
''' </summary>
''' <param name="doc"></param>
''' <param name="s"></param>
Public Sub SaveTIFFDocumentToStreamDemo(doc As TIFFDocument, s As Stream)
Dim test As New TIFEncoder()
Dim buffer As Byte() = New Byte(s.Length - 1) {}

Dim ms As New MemoryStream()

s.Read(buffer, 0, CInt(s.Length))
ms.Write(buffer, 0, CInt(s.Length))
test.EncodeDocument(doc, New FileIOMgr(ms))

' or
'doc.Save(s);
End Sub
If you want to get started with TIFF file using C#.NET code, please refer to this C#.NET TIFF creating, loading and saving tutorial page.
If you are looking some more multi-page TIFF file editing tutorials or VB.NET sample codes, RasterEdge provides other user manuals to suit your needs. You can learn how to add annotations to TIFF using Visual Basic, such as rectangle, ellipse, freehand and text, etc. You can also find VB.NET guide for converting TIFF file into other formats, like PDF or raster images. Besides, you can print various barcodes into TIFF in VB.NET, such as Code 39, Code 128 and EAN-13.


Recommend this to Google+


RasterEdge.com is professional provider of ASP.NET MVC Document Viewer, ASP.NET PDF Viewer, MVC PDF Viewer document, content and imaging solutions, available for ASP.NET AJAX, Silverlight, Windows Forms as well as WPF. We are dedicated to provide powerful & profession imaging controls, PDF document, image to pdf files and components for capturing, viewing, processing, converting, compressing and stroing images, documents and more.

©2000-2017 Raster Edge.com