5,401,186 members and growing! (17,208 online)
Email Password   helpLost your password?
Desktop Development » Files and Folders » File Formats     Intermediate License: The BSD License

Convert Tiff To Pdf

By sirrube

Tiff To PDF conversion Source Code.
VC6, C++Windows, Win2K, WinXP, MFC, VS6, Visual Studio, Dev

Posted: 7 Nov 2002
Updated: 17 Feb 2003
Views: 158,085
Bookmarked: 52 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
18 votes for this Article.
Popularity: 5.43 Rating: 4.32 out of 5
2 votes, 16.7%
1
1 vote, 8.3%
2
1 vote, 8.3%
3
2 votes, 16.7%
4
6 votes, 50.0%
5

Introduction

After looking everywhere for TiffToPdf source code, I decided to write my own conversion routine. It is fairly simple and straight forward and it fits my needs. I decided to return the favor and post this code here so others that need the capability can utilize it as well. Currently it only supports Tiff Image files in Fax formats.

What you need to compile.

You will need CXImage to compile and build. It only uses the CXFile / LIBTIFF functions of CXImage but CXImage is a nice library anyways.

Where to go from here

If you would like to extend it and make improvements on it please send me an e-mail with your improvements, and suggestions. It would be nice to extend this functionality.

How to use

This is the class function declaration for CDTPDFConvert::TiffToPdf The function requires an input tiff file. If there is no output pdf file it will use the tiff file name with the .pdf extension, the additional paramaters are for the pdf info header.

int TiffToPdf( char* a_tiff, char* a_pdf, char* a_szCreator,
                         char* a_szCreationDate, char * a_szAuthor,
                                   char * a_szProducer, char * a_szTitle,
                                   char * a_szSubject, char * a_szKeywords  );

This is an example of how to use the class. The class is wrapped with exception handling and has a error string that returns limited info if there was a problem. The error checking and exception handling can be improved drastically but for this purpose if you choose to use the code that is your responsibility.

void main()
{ 
  CDTPDFConvert convert;
  if (convert.TiffToPdf( a_in_tiff, a_out_pdf, Additional Paramaters ) < 1) {
    printf( convert.m_szErrorCode );
  } else
    printf( "Converted Tiff to Pdf!" );
}

Edit Revision

21 Nov 2002 - Initial Editing

18 Feb 2003 - I removed CXImage Dependicies (Code is loosely based on CXImage Lib a really cool library get it!). I also added libtiff into zip file. Added several image compression routines, and made it easier to build.

14 July 2003 - If you need the most recent working version of this source code with improvements and bug fixes check out my website. www.rubisoftware.com

License

This article, along with any associated source code and files, is licensed under The BSD License

About the Author

sirrube


A Software Developer.
Occupation: Web Developer
Location: United States United States

Other popular Files and Folders articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 25 of 104 (Total in Forum: 104) (Refresh)FirstPrevNext
Subject  Author Date 
GeneralHelp for C++ Link errormemberden32320:31 26 Jun '07  
Question"Searchable" PDF formatmemberAlexsander Antunes1:46 15 Feb '07  
GeneralTIFF G4 file cannot convert to pdfmemberAngela2006_200616:06 28 Nov '06  
GeneralHelp for C++ NovicememberKenny P6:31 27 Mar '06  
GeneralRe: Help for C++ Novicememberdaqi0:39 28 Sep '06  
GeneralEmbed?memberVasudevan Deepak Kumar5:17 14 Mar '06  
Generalhelp!!! Dont convert more then 1 filememberyanivo21:43 17 Jul '05  
Generalbmp jpg gif pngmemberdonj821:16 26 May '05  
GeneralRe: bmp jpg gif pngmemberVasudevan Deepak Kumar5:18 14 Mar '06  
Generaltoo bigmembercsunny18:52 10 May '05  
GeneralHow about PDF to TIFFsussAnonymous16:22 12 Dec '04  
GeneralRe: How about PDF to TIFFmemberdeepak827822:15 8 Feb '05  
GeneralRe: How about PDF to TIFFmemberjmlynn16:49 10 Feb '05  
GeneralRe: How about PDF to TIFFmemberdeepak827821:12 10 Feb '05  
GeneralRe: How about PDF to TIFFmemberPaul R.9:14 7 Nov '07  
AnswerRe: How about PDF to TIFFmemberfastal8:55 28 Feb '08  
GeneralCompilation problemmemberksvenkatakrishnan3:15 1 Oct '04  
GeneralRe: Compilation problemmemberPandele Florin0:32 18 Apr '05  
GeneralERRORsusspubba19:36 19 Jul '04  
GeneralHow to add bmp file as PDF File Format.susspubba20:19 18 Jul '04  
GeneralHow to convert from txt to tiff???memberJigar Mehta21:19 4 Jun '04  
GeneralRe: How to convert from txt to tiff???memberal_yakout23:02 4 Jun '04  
GeneralRe: How to convert from txt to tiff???memberJigar Mehta23:45 4 Jun '04  
GeneralRe: How to convert from txt to tiff???sussAnonymous20:55 5 Jun '04  
GeneralRe: How to convert from txt to tiff???memberal_yakout20:56 5 Jun '04  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 17 Feb 2003
Editor: Chris Maunder
Copyright 2002 by sirrube
Everything else Copyright © CodeProject, 1999-2008
Web16 | Advertise on the Code Project