⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtpdfconvert.h

📁 实现TIFF文件转换未PDF文件的源码
💻 H
字号:
//************************
//*      Chris Rubio     *
//*                      *
//*  Copyright (C) 2000  *
//*                      *
//*  dtpdfconvert.h      *
//************************
/*
    You are free to use,modify,make,sell,share or do whatever you want with this code.
    thanks to tifflib, and CxImage class, ImageMagick for inspiration. Please send any modifications to 
    +s i r r u b e 2 @ y a h o o . c o m+ so I can implement them as well if I choose. 

    Thanks to all the coders on code project in the past who have shared thier source as well.

    To build you need CXImage and libtiff.  /cvsroot/osrs/libtiff/libtiff.

*   THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND
*   EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
*   WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


*/
//****************************************************************************
//*                              REVISION HISTORY                            *
//****************************************************************************
//*   Date   *                                                     *   Who   *
//****************************************************************************
//* 11/8/2002* Created header file.                                *   CLR   *
//****************************************************************************
#ifndef DTPDFCONVERT_H
#define DTPDFCONVERT_H

class QTiff
{
  public:

   QTiff() { m_lPageCount = - 1; m_lPage = 0; };
  ~QTiff(){ close(); };

  int open( char* szTiff );
  void close() {   TIFFClose(m_tif); };
  long pagecount();
  void setpage( long a_lPage ) { TIFFSetDirectory(m_tif,(uint16)a_lPage); getdata(); m_lPage = a_lPage; }
  long page() { return m_lPage; }
  void getdata();
  int isFax();

  TIFF * m_tif;
  uint32 height;
  uint32 width;
  uint16 bitspersample;
  uint16 samplesperpixel;
  uint32 rowsperstrip;
  uint16 photometric;
  uint16 compression;
  uint16 orientation;
  uint32 x, y;
  float x_resolution, y_resolution, x_offset,y_offset;
  BOOL isRGB;
  CxFile hFile;  //file handle to read the image

  long m_lPageCount;
  long m_lPage;
};


class CDTPDFConvert
{
public:

  CDTPDFConvert() { memset(m_szErrorCode, 0, sizeof(char) * 255 );};
  ~CDTPDFConvert() {};

  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  );


  char m_szErrorCode[ 255 ];

private:
  int tiff_writePDFXObjectLength( FILE * pf, long nObj, QTiff & qt, fpos_t & start, fpos_t & end );
  int tiff_writePDFXObject( FILE * pf, long nObj, QTiff & qt, fpos_t & start, fpos_t & end );
  int tiff_writePDFProcsetObject( FILE * pf, long nObj, QTiff & qt, fpos_t & start, fpos_t & end );
  int tiff_writePDFContentsObject( FILE * pf, long nObj, QTiff & qt, fpos_t & start, fpos_t & end );
  int tiff_writePDFPageObject( FILE * pf, long nObj, long pages_id , QTiff & qt );
  int tiff_writePDFPagesObject( FILE * pf, long nObj, QTiff & qt );
  int tiff_writePDFCatalogObject( FILE * pf, long nObj );
  int tiff_writePDFInfoObject( FILE * pf, char* a_szCreator, char* a_szCreationDate, char * a_szAuthor, char * a_szProducer, char * a_szTitle, char * a_szSubject,  char * a_szKeywords  );
};




#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -