1 /* 2 * Copyright 2012 Canonical Ltd. 3 * Copyright 2018 Sahil Arora <sahilarora.535@gmail.com> 4 * 5 * This program is free software: you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 3, as published 7 * by the Free Software Foundation. 8 * 9 * This program is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranties of 11 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 12 * PURPOSE. See the GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License along 15 * with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef pdf_h 19 #define pdf_h 20 21 #include <stdio.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef struct QPDF pdf_t; 28 29 typedef struct _opt opt_t; 30 31 /* 32 * Type to bunch PDF form field name and its value. 33 */ 34 struct _opt { 35 const char* key; 36 const char* val; 37 opt_t *next; 38 }; 39 40 pdf_t * pdf_load_template(const char *filename); 41 void pdf_free(pdf_t *pdf); 42 void pdf_write(pdf_t *doc, FILE *file); 43 void pdf_prepend_stream(pdf_t *doc, unsigned page, char const *buf, size_t len); 44 void pdf_add_type1_font(pdf_t *doc, unsigned page, const char *name); 45 void pdf_resize_page(pdf_t *doc, unsigned page, float width, float length, float *scale); 46 void pdf_duplicate_page (pdf_t *doc, unsigned page, unsigned count); 47 int pdf_fill_form(pdf_t *doc, opt_t *opt); 48 int pdf_pages(const char *filename); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif 55