Re: Unable to use FAXCOMLib with certain TIFF formats.



Is your bitmap monochrome? Only mono bitmaps can be saved as CCITT4. THe PixelFormat must be PixelFormat.Format1bppIndexed

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Orbian" <orbian123@xxxxxxxxxxx> wrote in message news:1123722464.607311.39230@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for the response. I had to modify your code snippet slightly
since I was unable to find a GetEncoderInfo function but I believe it
is similar to what I added. The problem is when I use the CCITT4
compression I get an "Invalid parameter" exception. Am I missing
something?


ImageCodecInfo info=null;
foreach(ImageCodecInfo ice in ImageCodecInfo.GetImageEncoders())
{
if(ice.MimeType=="image/tiff")
{
info=ice;
}
}

EncoderParameters ep = new EncoderParameters(2);

ep.Param[1] = new EncoderParameter(Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);
ep.Param[0] = new EncoderParameter(Encoder.Compression,
(long)EncoderValue.CompressionCCITT4);

m_Bmp.Save("test.tif", info, ep);


Thanks Bob Herzberg



Alex Feinman [MVP] wrote:
I see. As far as I know, attempting to send a document with any extension
but .tif will result in it being printed to fax printer driver to convert it
to tiff. For TIFF files a validation is done. If the validation fails, the
method call will fail too - there will be made no attempt to print it. Two
choices - either rename your document to .PNG (no matter that it's still
tiff inside - it wil lbe printed properly since the printing application
sniffs the stream rather than trusts file extensions), or try to ensure
compatibility of your image.


The things that the Fax library cares about are primarily resolution,
bit-per-pixels and encoding. From the first glance I can tell you that your
document has resolution of 100x100 instead of 204x98 or 204x196
Open your tif file using MS Office Document Imaging application and under
View check the page properties. Compression needs to be either CCITT3 or
CCITT4. If it is LZW, you won't be able to fax it.


If you are using System.Drawing.Imaging.Encoder to save the bitmap, you will
need the following code:


EncoderParameters ep = new EncoderParameters(2);

ep.Param[1] = new EncoderParameter(Encoder.SaveFlag,
(long)EncoderValue.MultiFrame);

ep.Param[0] = new EncoderParameter(Encoder.Compression,
(long)EncoderValue.CompressionCCITT4);

myBitmap.Save(fileName, GetEncoderInfo(ImageFormat.Tif­f), ep);


-- Alex Feinman --- Visit http://www.opennetcf.org "Orbian" <orbian123@xxxxxxxxxxx> wrote in message news:1123708127.736302.284600@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx > > Alex Feinman [MVP] wrote: >> Could you post the code you use to submit the TIFF as a fax? Normally >> even >> tiff files will be subject to printing to fax printer driver, so there >> should be no difference between native and generated files >> >> -- >> Alex Feinman >> --- > > > Here is the code I send the fax with. Again, it only works with TIFF > files generated by the fax server, or if I run it in a Windows Form > application. It fails on DotNet generated files when invoked from a web > service. > > private bool SendFax(string faxnum, string fname) > { > string host = null; > int jobID; > > FAXCOMLib.FaxServerClass fserver = new FAXCOMLib.FaxServerClass(); > FAXCOMLib.FaxDoc doc; > > fserver.Connect(host); > > doc = (FAXCOMLib.FaxDoc)fserver.CreateDocument(fname); > > doc.FaxNumber = faxnum; > jobID = doc.Send(); > > return(true); > > } > > > Thanks, > Bob Herzberg >

.