BoggeRs
08-08-2008, 09:37 PM
Hello,
I am in the process of creating a console application that will dynamically create and upload files ( that are converted from TIFF to PDF ) automatically when put in a directory.
I have found some 400$-700$ addons for .NET to convert the TIFF to PDF but I was wondering if anyone knew any that were open source / free.
This of course will be a windows system running.
Any help at all will be greatly appreciated. Thank You.
lockbull
08-10-2008, 10:48 PM
I'm familiar with iText (which is a popular Java PDF library); apparently there is a .NET port of it but I have no experience with it:
http://sourceforge.net/projects/itextsharp/?abmode=1
aplawson
08-12-2008, 03:46 PM
The best I can do here is for converting TIFF files to other image files. NOT for converting TIFF to PDF per se...
public static byte[] ConvertImage(byte[] fromImage, string mimeType)
{
// Read the image from the byte variable into a bitmap variable
MemoryStream fromImageStream = new MemoryStream();
fromImageStream.Write(fromImage, 0, fromImage.Length);
Image image = Image.FromStream( fromImageStream, true ) ;
Bitmap bitmap = (Bitmap) image;
// Instantiate the encoder
EncoderParameters encoderParams = new EncoderParameters();
encoderParams.Param[0] = new EncoderParameter( Encoder.Quality, 50L );
ImageCodecInfo codecInfo = GetEncoderInfo( mimeType );
MemoryStream newImage = new MemoryStream();
// Convert the image to the new format
bitmap.Save( newImage, codecInfo, encoderParams );
// Read the new image into a byte variable
byte[] data = newImage.ToArray();
if (Logger.LogSwitch.LogInfo)
{
Logger.Write("ImageUtility", "EXITING ConvertImage method");
}
return data;
}
private static ImageCodecInfo GetEncoderInfo(String mimeType)
{
int j;
ImageCodecInfo[] encoders;
encoders = ImageCodecInfo.GetImageEncoders();
for(j = 0; j < encoders.Length; ++j)
{
if(encoders[j].MimeType == mimeType)
return encoders[j];
}
return null;
}
aplawson
08-12-2008, 03:54 PM
I'd also suggest:
- PDFSharp.com (http://www.pdfsharp.com)
- http://www.pdfonline.com/easypdf/sdk/index_csharp.htm?gclid=CPH0__H03YwCFSBMGgodsVLm6g
- http://www.pdfonline.com/easypdf/sdk/sample_code.htm#convertpdf
Good luck!
Form1
08-13-2008, 11:40 AM
Use ghostscript and tiff2ps from libtiff, then something like this:
tiff2ps your_tiff_name_here.tiff | ps2pdf - > your_pdf_filename_here.pdf
Take it easy,
David Berube