Leptonica 1.68
C Image Processing Library
|
00001 /*====================================================================* 00002 - Copyright (C) 2001 Leptonica. All rights reserved. 00003 - This software is distributed in the hope that it will be 00004 - useful, but with NO WARRANTY OF ANY KIND. 00005 - No author or distributor accepts responsibility to anyone for the 00006 - consequences of using this software, or for whether it serves any 00007 - particular purpose or works at all, unless he or she says so in 00008 - writing. Everyone is granted permission to copy, modify and 00009 - redistribute this source code, for commercial or non-commercial 00010 - purposes, with the following restrictions: (1) the origin of this 00011 - source code must not be misrepresented; (2) modified versions must 00012 - be plainly marked as such; and (3) this notice may not be removed 00013 - or altered from any source or modified source distribution. 00014 *====================================================================*/ 00015 00016 /* 00017 * printtiff.c 00018 * 00019 * Syntax: printtiff filein [printer] 00020 * 00021 * Prints a multipage tiff file to a printer. If the tiff is 00022 * at standard fax resolution, it expands the vertical size 00023 * by a factor of two before encapsulating in ccittg4 encoded 00024 * PostScript. The PostScript file is left in /tmp, and 00025 * erased (deleted, removed, unlinked) on the next invocation. 00026 * 00027 * If the printer is not specified, this just writes the PostScript 00028 * file into /tmp. 00029 */ 00030 00031 #include "allheaders.h" 00032 00033 #define TEMP_PS "/tmp/junk_printtiff.ps" 00034 #define FILL_FACTOR 0.95 00035 00036 main(int argc, 00037 char **argv) 00038 { 00039 char *filein, *printer; 00040 char buffer[512]; 00041 l_int32 ignore; 00042 static char mainName[] = "printtiff"; 00043 00044 if (argc != 2 && argc != 3) 00045 exit(ERROR_INT(" Syntax: printtiff filein [printer]", mainName, 1)); 00046 00047 filein = argv[1]; 00048 if (argc == 3) 00049 printer = argv[2]; 00050 00051 sprintf(buffer, "rm -f %s", TEMP_PS); 00052 ignore = system(buffer); 00053 00054 convertTiffMultipageToPS(filein, TEMP_PS, NULL, FILL_FACTOR); 00055 00056 if (argc == 3) { 00057 sprintf(buffer, "lpr -P%s %s &", printer, TEMP_PS); 00058 ignore = system(buffer); 00059 } 00060 00061 return 0; 00062 } 00063