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 typedef struct PdfImage {
66 int n_obj_smask; /* only if has_alpha */
68 gboolean used_in_this_page;
72 #define PDFTYPE_CST 0 // intval: true=1, false=0, null=-1
73 #define PDFTYPE_INT 1 // intval
74 #define PDFTYPE_REAL 2 // realval
75 #define PDFTYPE_STRING 3 // str, len
76 #define PDFTYPE_NAME 4 // str
77 #define PDFTYPE_ARRAY 5 // num, elts
78 #define PDFTYPE_DICT 6 // num, elts, names
79 #define PDFTYPE_STREAM 7 // dict: num, elts, names; data: str, len
80 #define PDFTYPE_REF 8 // intval, num
82 struct PdfObj *parse_pdf_object(char **ptr, char *eof);
83 void free_pdfobj(struct PdfObj *obj);
84 struct PdfObj *dup_pdfobj(struct PdfObj *obj);
85 struct PdfObj *get_pdfobj(GString *pdfbuf, struct XrefTable *xref, struct PdfObj *obj);
86 void make_xref(struct XrefTable *xref, int nobj, int offset);
88 gboolean pdf_parse_info(GString *pdfbuf, struct PdfInfo *pdfinfo, struct XrefTable *xref);
90 // main printing functions
92 gboolean print_to_pdf(char *filename);
94 #if GTK_CHECK_VERSION(2, 10, 0)
95 void print_job_render_page(GtkPrintOperation *print, GtkPrintContext *context, gint pageno, gpointer user_data);