]> www.fi.muni.cz Git - evince.git/blob - ps/ps.h
Do not include ev-poppler.h when pdf is disabled.
[evince.git] / ps / ps.h
1 /*
2  * ps.h -- Include file for PostScript routines.
3  * Copyright (C) 1992  Timothy O. Theisen
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  *   Author: Tim Theisen           Systems Programmer
20  * Internet: tim@cs.wisc.edu       Department of Computer Sciences
21  *     UUCP: uwvax!tim             University of Wisconsin-Madison
22  *    Phone: (608)262-0438         1210 West Dayton Street
23  *      FAX: (608)262-9777         Madison, WI   53706
24  */
25 #ifndef __GGV_PS_H__
26 #define __GGV_PS_H__
27
28 #include <stdio.h>
29
30 #include <gsio.h>
31 #include <gstypes.h>
32
33 G_BEGIN_DECLS
34
35 /* Constants used to index into the bounding box array. */
36 #define LLX 0
37 #define LLY 1
38 #define URX 2
39 #define URY 3
40
41 /* Constants used to store keywords that are scanned. */
42 /* NONE is not a keyword, it tells when a field was not set */
43
44 enum { ATEND = -1, NONE = 0, ASCEND, DESCEND, SPECIAL };
45
46 #define PSLINELENGTH 257     /* 255 characters + 1 newline + 1 NULL */
47
48 struct document {
49   int epsf;                     /* Encapsulated PostScript flag. */
50   char *title;                  /* Title of document. */
51   char *date;                   /* Creation date. */
52   char *creator;                /* Program that created the file */
53   int pageorder;                /* ASCEND, DESCEND, SPECIAL */
54   long beginheader, endheader;  /* offsets into file */
55   unsigned int lenheader;
56   long beginpreview, endpreview;
57   unsigned int lenpreview;
58   long begindefaults, enddefaults;
59   unsigned int lendefaults;
60   long beginprolog, endprolog;
61   unsigned int lenprolog;
62   long beginsetup, endsetup;
63   unsigned int lensetup;
64   long begintrailer, endtrailer;
65   unsigned int lentrailer;
66   int boundingbox[4];
67   int default_page_boundingbox[4];
68   int orientation;              /* GTK_GS_ORIENTATION_PORTRAIT, GTK_GS_ORIENTATION_LANDSCAPE */
69   int default_page_orientation; /* GTK_GS_ORIENTATION_PORTRAIT, GTK_GS_ORIENTATION_LANDSCAPE */
70   unsigned int numsizes;
71   GtkGSPaperSize *size;
72   GtkGSPaperSize *default_page_size;
73   unsigned int numpages;
74   struct page *pages;
75 };
76
77 struct page {
78   char *label;
79   int boundingbox[4];
80   GtkGSPaperSize *size;
81   int orientation;              /* GTK_GS_ORIENTATION_PORTRAIT, GTK_GS_ORIENTATION_LANDSCAPE */
82   long begin, end;              /* offsets into file */
83   unsigned int len;
84 };
85
86 /* scans a PostScript file and return a pointer to the document
87    structure.  Returns NULL if file does not Conform to commenting
88    conventions . */
89 struct document *psscan(FILE * fileP, int respect_eof, const gchar * fname);
90
91 /* free data structure malloc'ed by psscan */
92 void psfree(struct document *);
93
94 /* Copy a portion of the PostScript file */
95 void pscopy(FILE * from, GtkGSDocSink * to, long begin, long end);
96
97 /* Copy a portion of the PostScript file upto a comment */
98 char *pscopyuntil(FILE * from, GtkGSDocSink * to, long begin, long end,
99                   const char *comment);
100
101 /* Copy the headers, marked pages, and trailer to fp */
102 void pscopydoc(GtkGSDocSink * dest_file, char *src_filename,
103                struct document *d, int *pagelist);
104
105 G_END_DECLS
106
107 #endif /* __GGV_PS_H__ */