473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Tiff File Creation For Fax With FAXCOMLib

Hi All,

I am trying to create a .tiff file to fax using the windows fax service
FAXCOMLib.
I have created an array of images (bitmaps) and converted them to 1pbb
format in order to allow CCITT3/4 compression for faxing.

The .Tiff file appears to be created successfully however when I try to send
the file as a fax I get the error:
System.Runtime.InteropServices.COMException (0x8007000D): The data is
invalid.

Most other file formats (.txt, .doc etc) send are sent using my faxing code
fine.
My code to send the fax is:

Dim fs As New FAXCOMLib.FaxServerClass
fs.Connect(Environment.MachineName) '//specifies the machinename
Dim obj As Object = fs.CreateDocument(pathToImage)
Dim fd As FAXCOMLib.FaxDoc = CType(obj, FAXCOMLib.FaxDoc)
fd.FaxNumber = txtNumber.Text
Dim i As Integer = fd.Send()
fd = Nothing
fs.Disconnect()
fs = Nothing

As the code above appears to function correctly when not sending one of the
tiff images I have created, Im guessing that Im doing something wrong in my
Tiff image creation code:

Private Function createTiffImage(ByVal bitmapArray() As Bitmap) As String
'get the codec for tiff files
Dim info As ImageCodecInfo = Nothing
Dim ice As ImageCodecInfo
Dim faxPath As String = Application.StartupPath & "\SPLREP\Fax.tiff"

For Each ice In ImageCodecInfo.GetImageEncoders()
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next ice

'use the save encoder
Dim enc As Encoder = Encoder.SaveFlag
Dim enc1 As Encoder = Encoder.Compression

Dim ep As New EncoderParameters(2)

ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.MultiFrame))
ep.Param(1) = New EncoderParameter(enc1,
CLng(EncoderValue.CompressionCCITT3))

Dim pages As Bitmap = Nothing
Dim i As Integer = 0

For i = 0 To bitmapArray.GetUpperBound(0) Step 1
If i = 0 Then
'save the first frame
pages = bitmapArray(i)
pages.Save(faxPath, info, ep)
Else
'save the intermediate frames
ep.Param(0) = New EncoderParameter(enc,
CLng(EncoderValue.FrameDimensionPage))
ep.Param(1) = New EncoderParameter(enc1,
CLng(EncoderValue.CompressionCCITT3))
pages.SaveAdd(bitmapArray(i), ep)
End If

If i = bitmapArray.GetUpperBound(0) Then
'flush and close.
ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.Flush))
ep.Param(1) = New EncoderParameter(enc1,
CLng(EncoderValue.CompressionCCITT3))
pages.SaveAdd(ep)
End If
Next
Return faxPath
End Function

The Tiff images seem to be recognised by image manipulation programs (e.g.
IrfanView) but are invalid as fax files. What do I need to do to make the
Tiff image a valid fax file?

Thanx very much in advance for all your help.

Will @ Multepos

Nov 21 '05 #1
0 1991

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ponty | last post by:
HI, I'm trying to send a fax to our server via a .net web page, but I keep getting permission errors. The code works fine on win xp, but on 2000, i get System.UnauthorizedAccessException:...
0
by: Will Arrowsmith | last post by:
Hi All, I am aiming to create a multiframe Tiff file that I can fax using the windows fax service FAXCOMLib. I have created an array of Bitmaps (pages I want in my fax doc) and succesfully...
5
by: Eddie Leung | last post by:
Hi All, As I know that the tiff contain header information, I can use one software called tifftags.exe to get tiff tag information. However, I can't get any reference from vb.net to do such...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
5
by: Sameer Gupta | last post by:
what are options for opening / handling tiff files in .Net framework ? which is the best library, namespace ? Please help Regards Sameer Gupta C# Designer & Developer Siemens UK
0
by: Stedak | last post by:
We are scanning images and saving them as TIFF's in a database. We are running into some problems because in the creation of the TIFF the EncoderValue.CompressionLZW is ignored. It does not seem to...
7
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g....
8
by: Robert Dufour | last post by:
I been trying to look for samplecodes on how to create a simple tif file. I found a lot of commercial and stuff but I would prefer to roll my own. I only need to put some formatted text in a tif...
2
by: mndprasad | last post by:
hi all i am doing a project in java where i need to convert 10 jpeg images into a single tiff image..conversion of single jpeg image to single tiff is happening but embedding all the 10 jpeg images...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.