1 /* scanimage -- command line scanning utility 2 * Uses the SANE library. 3 * 4 * Copyright (C) 2021 Thierry HUCHARD <thierry@ordissimo.com> 5 * 6 * For questions and comments contact the sane-devel mailinglist (see 7 * http://www.sane-project.org/mailing-lists.html). 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License as 11 * published by the Free Software Foundation; either version 2 of the 12 * License, or (at your option) any later version. 13 * 14 * This program is distributed in the hope that it will be useful, but 15 * WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program. If not, see <https://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef __JPEG_TO_PDF_H__ 24 #define __JPEG_TO_PDF_H__ 25 26 #include "../include/_stdint.h" 27 28 #include "../include/sane/sane.h" 29 #include "../include/sane/sanei.h" 30 #include "../include/sane/saneopts.h" 31 32 33 34 #ifndef PATH_MAX 35 # define PATH_MAX 4096 36 #endif 37 38 typedef long long SANE_Int64; 39 40 /* sane_pdf_StartPage - type */ 41 enum { 42 SANE_PDF_IMAGE_COLOR = 0, /* RGB24bit */ 43 SANE_PDF_IMAGE_GRAY, /* Gray8bit */ 44 SANE_PDF_IMAGE_MONO, /* Gray1bit */ 45 SANE_PDF_IMAGE_NUM, 46 }; 47 48 /* sane_pdf_StartPage - rotate */ 49 enum { 50 SANE_PDF_ROTATE_OFF = 0, /* rotate off */ 51 SANE_PDF_ROTATE_ON, /* rotate 180 degrees */ 52 }; 53 54 55 typedef struct mynode 56 { 57 SANE_Int page; 58 SANE_Int show_page; 59 SANE_Int rotate; 60 struct mynode *prev; 61 struct mynode *next; 62 FILE* fd; 63 SANE_Int file_size; 64 SANE_Byte file_path[ PATH_MAX ]; 65 } SANE_PDF_NODE, *LPSANE_PDF_NODE; 66 67 68 SANE_Int sane_pdf_open( void **ppw, FILE* fd ); 69 void sane_pdf_close( void *pw ); 70 71 SANE_Int sane_pdf_start_doc( void *pw ); 72 SANE_Int sane_pdf_end_doc( void *pw ); 73 74 SANE_Int sane_pdf_start_page( void *pw, SANE_Int w, SANE_Int h, SANE_Int res, SANE_Int type, SANE_Int rotate ); 75 SANE_Int sane_pdf_end_page( void *pw ); 76 77 #endif /* __JPEG_TO_PDF_H__ */ 78