2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) any later version.
7 * This software is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 typedef struct XrefTable {
22 typedef struct PdfPageDesc {
23 struct PdfObj *resources, *mediabox, *contents;
27 typedef struct PdfInfo {
29 struct PdfObj *trailerdict;
31 struct PdfPageDesc *pages;
34 typedef struct PdfObj {
44 typedef struct PdfFont {
46 gboolean used_in_this_page;
53 char *glyphpsnames[256];
55 // fields from the FT_Face
58 int ascender, descender, xmin, xmax, ymin, ymax; // in PDF font units
63 #define PDFTYPE_CST 0 // intval: true=1, false=0, null=-1
64 #define PDFTYPE_INT 1 // intval
65 #define PDFTYPE_REAL 2 // realval
66 #define PDFTYPE_STRING 3 // str, len
67 #define PDFTYPE_NAME 4 // str
68 #define PDFTYPE_ARRAY 5 // num, elts
69 #define PDFTYPE_DICT 6 // num, elts, names
70 #define PDFTYPE_STREAM 7 // dict: num, elts, names; data: str, len
71 #define PDFTYPE_REF 8 // intval, num
73 struct PdfObj *parse_pdf_object(char **ptr, char *eof);
74 void free_pdfobj(struct PdfObj *obj);
75 struct PdfObj *dup_pdfobj(struct PdfObj *obj);
76 struct PdfObj *get_pdfobj(GString *pdfbuf, struct XrefTable *xref, struct PdfObj *obj);
77 void make_xref(struct XrefTable *xref, int nobj, int offset);
79 gboolean pdf_parse_info(GString *pdfbuf, struct PdfInfo *pdfinfo, struct XrefTable *xref);
81 // main printing functions
83 gboolean print_to_pdf(char *filename);
85 #if GTK_CHECK_VERSION(2, 10, 0)
86 void print_job_render_page(GtkPrintOperation *print, GtkPrintContext *context, gint pageno, gpointer user_data);