* Page Size (for the Page Size), Bounding Box (to minimize backing
* pixmap size or determine window size for encapsulated PostScript),
* Orientation of Paper (for default transformation matrix), and
- * Page Order. The title and CreationDate are also retrieved to
+ * Page Order. The Title, Creator, and CreationDate are also retrieved to
* help identify the document.
*
* The following comments are examined:
*
* %!PS-Adobe-* [EPSF-*]
* %%BoundingBox: <int> <int> <int> <int>|(atend)
+ * %%Creator: <textline>
* %%CreationDate: <textline>
* %%Orientation: Portrait|Landscape|(atend)
* %%Pages: <uint> [<int>]|(atend)
In a way, this makes sense, a program PostScript does not need
the !PS at the beginning.
*/
- /* use a test command to determine if ghostscript can
- understand this document! */
- gchar *test_cmd;
-
- test_cmd = g_strdup_printf
- ("%s -dNOPAUSE -dBATCH -sDEVICE=nullpage %s "
- "1>/dev/null 2>/dev/null", gtk_gs_defaults_get_interpreter_cmd(), fname);
- if(system(test_cmd) != 0) {
- g_free(test_cmd);
- return NULL;
- }
- g_free(test_cmd);
doc = g_new0(struct document, 1);
doc->default_page_orientation = GTK_GS_ORIENTATION_NONE;
doc->orientation = GTK_GS_ORIENTATION_NONE;
else if(doc->date == NULL && iscomment(line + 2, "CreationDate:")) {
doc->date = gettextline(line + length("%%CreationDate:"));
}
+ else if(doc->creator == NULL && iscomment(line + 2, "Creator:")) {
+ doc->creator = gettextline(line + length("%%Creator:"));
+ }
else if(bb_set == NONE && iscomment(line + 2, "BoundingBox:")) {
sscanf(line + length("%%BoundingBox:"), "%256s", text);
if(strcmp(text, "(atend)") == 0) {
if(!DSCcomment(line)) {
/* Do nothing */
}
- else if(doc->default_page_orientation == NONE &&
+ else if(doc->default_page_orientation == GTK_GS_ORIENTATION_NONE &&
iscomment(line + 2, "PageOrientation:")) {
sscanf(line + length("%%PageOrientation:"), "%256s", text);
if(strcmp(text, "Portrait") == 0) {
if(!DSCcomment(line)) {
/* Do nothing */
}
- else if(doc->default_page_orientation == NONE &&
+ else if(doc->default_page_orientation == GTK_GS_ORIENTATION_NONE &&
iscomment(line + 2, "PageOrientation:")) {
sscanf(line + length("%%PageOrientation:"), "%256s", text);
if(strcmp(text, "Portrait") == 0) {
doc->lensetup = section_len - line_len;
}
- /* Added this (Nov. 2, 1999) when I noticed that
- a Postscript file would load in gv but not in ggv
-
- dmg@csg.uwaterloo.ca */
+ /* HACK: Mozilla 1.8 Workaround.
+
+ It seems that Mozilla 1.8 generates important postscript code
+ after the '%%EndProlog' and before the first page comment '%%Page: x y'.
+ See comment below also.
+ */
+
+ if(doc->beginprolog && !doc->beginsetup) {
+ doc->lenprolog += section_len - line_len;
+ doc->endprolog = position;
+ }
+
+ /* HACK: Windows NT Workaround
- /* BEGIN Windows NT fix ###jp###
- Mark Pfeifer (pfeiferm%ppddev@comet.cmis.abbott.com) told me
+ Mark Pfeifer (pfeiferm%ppddev@comet.cmis.abbott.com) noticed
about problems when viewing Windows NT 3.51 generated postscript
files with gv. He found that the relevant postscript files
show important postscript code after the '%%EndSetup' and before
doc->endsetup = position;
}
}
- /* END Windows NT fix ###jp## */
/* Individual Pages */
g_free(doc->title);
if(doc->date)
g_free(doc->date);
+ if(doc->creator)
+ g_free(doc->creator);
if(doc->pages)
g_free(doc->pages);
if(doc->size)