473,503 Members | 2,150 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tiff File Creation For FAXCOMLib

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 converted them all to be 1bppIndexed.
I then combine all bitmaps into a single multiframed Tiff file (with CCITT3
compression) before attempting to fax the file.

When I call the send method of the fax routine I get the error:
"System.Runtime.InteropServices.COMException (0x8007000D): The data is
invalid."
However if I try and fax any other document then the routine works fine and
transmitts the fax succesfully. For your info here is my fax routine:

Dim fs As New FAXCOMLib.FaxServerClass
fs.Connect(Environment.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

Because the above fax routine works with all other file types I'm guessing
that I have a problem with my Tiff creation routine (although it does not
generate an error). The routine is as follows:

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

What do I need to do in my creation routine in order to allow the FAXCOMLib
service to recognise the Tiff file as a valid fax and hence get past the
'invalid data' error?

Thanx in advance for all your help.

Will @ Multepos

Nov 21 '05 #1
0 1673

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

Similar topics

0
1403
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
2000
by: Will Arrowsmith | last post by:
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...
5
7327
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
10019
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
14955
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
1399
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
3769
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
1493
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
4963
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
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7349
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...
1
7008
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
7467
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5594
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3168
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
746
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.