Click here to Skip to main content
11,709,536 members (51,686 online)
Click here to Skip to main content

Convert Tiff To Pdf

, 17 Feb 2003 BSD 326K 11K 84
Rate this:
Please Sign up or sign in to vote.
Tiff To PDF conversion Source Code.

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

Share

About the Author

sirrube
Web Developer
United States United States
A Software Developer.

You may also be interested in...

Comments and Discussions

 
Questionconvert tiff to pdf Pin
Member 1114341411-Oct-14 4:13
memberMember 1114341411-Oct-14 4:13 
AnswerRe: convert tiff to pdf Pin
wathshailesh13-Feb-15 6:01
memberwathshailesh13-Feb-15 6:01 
QuestionMessage Automatically Removed Pin
26-Apr-13 21:08
memberMember 997734926-Apr-13 21:08 
GeneralHelp for C++ Link error Pin
den32326-Jun-07 19:31
memberden32326-Jun-07 19:31 
Question"Searchable" PDF format Pin
Alexsander Antunes15-Feb-07 0:46
memberAlexsander Antunes15-Feb-07 0:46 
GeneralTIFF G4 file cannot convert to pdf Pin
Angela2006_200628-Nov-06 15:06
memberAngela2006_200628-Nov-06 15:06 
GeneralHelp for C++ Novice Pin
Kenny P27-Mar-06 5:31
memberKenny P27-Mar-06 5:31 
GeneralRe: Help for C++ Novice Pin
daqi27-Sep-06 23:39
memberdaqi27-Sep-06 23:39 
QuestionEmbed? Pin
Vasudevan Deepak Kumar14-Mar-06 4:17
memberVasudevan Deepak Kumar14-Mar-06 4:17 
Generalhelp!!! Dont convert more then 1 file Pin
yanivo17-Jul-05 20:43
memberyanivo17-Jul-05 20:43 
Generalbmp jpg gif png Pin
donj8226-May-05 0:16
memberdonj8226-May-05 0:16 
GeneralRe: bmp jpg gif png Pin
Vasudevan Deepak Kumar14-Mar-06 4:18
memberVasudevan Deepak Kumar14-Mar-06 4:18 
Generaltoo big Pin
csunny10-May-05 17:52
membercsunny10-May-05 17:52 
QuestionHow about PDF to TIFF Pin
Anonymous12-Dec-04 15:22
sussAnonymous12-Dec-04 15:22 
AnswerRe: How about PDF to TIFF Pin
deepak82788-Feb-05 21:15
memberdeepak82788-Feb-05 21:15 
GeneralRe: How about PDF to TIFF Pin
jmlynn10-Feb-05 15:49
memberjmlynn10-Feb-05 15:49 
GeneralRe: How about PDF to TIFF Pin
deepak827810-Feb-05 20:12
memberdeepak827810-Feb-05 20:12 
GeneralRe: How about PDF to TIFF Pin
Paul R.7-Nov-07 8:14
memberPaul R.7-Nov-07 8:14 
AnswerRe: How about PDF to TIFF Pin
fastal28-Feb-08 7:55
memberfastal28-Feb-08 7:55 
GeneralCompilation problem Pin
ksvenkatakrishnan1-Oct-04 2:15
memberksvenkatakrishnan1-Oct-04 2:15 
GeneralRe: Compilation problem Pin
Pandele Florin17-Apr-05 23:32
memberPandele Florin17-Apr-05 23:32 
GeneralERROR Pin
pubba19-Jul-04 18:36
susspubba19-Jul-04 18:36 
QuestionHow to add bmp file as PDF File Format. Pin
pubba18-Jul-04 19:19
susspubba18-Jul-04 19:19 
QuestionHow to convert from txt to tiff??? Pin
Jigar Mehta4-Jun-04 20:19
memberJigar Mehta4-Jun-04 20:19 
AnswerRe: How to convert from txt to tiff??? Pin
al_yakout4-Jun-04 22:02
memberal_yakout4-Jun-04 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150819.1 | Last Updated 18 Feb 2003
Article Copyright 2002 by sirrube
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid