Hi! I can't print the PS-files generated by fig2dev on the following PostScript printers: HP lj1200, Samsung CLP550 The printer outputs empty pages only.
So it's not a problem with a single strange .ppd-file only.
When I catch the output Cups sends to the printer and try to view it in
gv the pages are empty, too.
The attached patch makes fig2dev produce more correctly structured PostScript.
* Files get printed via Cups on PostScript printers.
* When viewing a .ps-file in gv you can go to the last page and back and
to the last page again without getting PostScript errors.
I've tested .eps-output and singlepage and multipage .ps-output and
couldn't see any ill side-effects.
A little clean-up to the patch would be good, nevertheless.
Greetings,
Roni
--- f2d/transfig-3.2.5-alpha7/fig2dev/dev/genps.oldpatterns.c 2004-10-11
18:15:54.000000000 +0200
+++ f2dp2/transfig-3.2.5-alpha7/fig2dev/dev/genps.oldpatterns.c 2006-11-04
17:13:17.000000000 +0100
@@ -749,6 +749,7 @@
}
}
+ fprintf(tfp,"%%%%BeginProlog\n");
if (pats_used)
fprintf(tfp,"/MyAppDict 100 dict dup begin def\n");
fprintf(tfp, "%s", BEGIN_PROLOG1);
@@ -758,13 +759,6 @@
genps_usr_colors();
fprintf(tfp, "\nend\n");
- /* must specify translation/rotation before definition of fill patterns
*/
- fprintf(tfp, "save\n");
-
- /* now make the clipping path for the BoundingBox */
- fprintf(tfp, "newpath %d %d moveto %d %d lineto %d %d lineto %d %d
lineto closepath clip newpath\n",
- cliplx,clipuy, cliplx,cliply, clipux,cliply, clipux,clipuy);
-
/* fill the Background now if specified */
if (bgspec) {
fprintf(tfp, "%% Fill background color\n");
@@ -785,12 +779,6 @@
/* translate (in multi-page mode this is done at end of this proc) */
/* (rotation and y flipping is done in %%BeginPageSetup area */
- if (!multi_page) {
- fprintf(tfp, "%.1f %.1f translate\n", origx, origy);
- if (epsflag)
- /* increasing y goes down */
- fprintf(tfp, "1 -1 scale\n");
- }
if (pats_used) {
int i;
fprintf(tfp, "\n%s%s%s", FILL_PROLOG1,FILL_PROLOG2,FILL_PROLOG3);
@@ -842,25 +830,53 @@
#endif /* I18N */
fprintf(tfp, "%s\n", END_PROLOG);
+
+ fprintf(tfp, "/pageheader {\n");
+
+ /* must specify translation/rotation before definition of fill patterns
*/
+ fprintf(tfp, "save\n");
+
+ /* now make the clipping path for the BoundingBox */
+ fprintf(tfp, "newpath %d %d moveto %d %d lineto %d %d lineto %d %d
lineto closepath clip newpath\n",
+ cliplx,clipuy, cliplx,cliply, clipux,cliply, clipux,clipuy);
+ if (!multi_page) {
+ fprintf(tfp, "%.1f %.1f translate\n", origx, origy);
+ if (epsflag)
+ /* increasing y goes down */
+ fprintf(tfp, "1 -1 scale\n");
+ }
fprintf(tfp, "$F2psBegin\n");
fprintf(tfp, "10 setmiterlimit\n"); /* make like X server (11
degrees) */
fprintf(tfp, "0 slj 0 slc\n"); /* set initial join style to
miter and cap to butt */
+ if( !multi_page)
+ fprintf(tfp, " %.5f %.5f sc\n", scalex, scaley );
+ fprintf(tfp,"} bind def\n");
+
+
+ fprintf(tfp,"/pagefooter {\n");
+ fprintf(tfp,"$F2psEnd\n");
+ fprintf(tfp,"restore\n");
+ fprintf(tfp,"} bind def\n");
+
if (multi_page) {
/* reset the matrix for multipage mode */
fprintf(tfp, "initmatrix\n");
} else {
- fprintf(tfp, " %.5f %.5f sc\n", scalex, scaley );
+ fprintf(tfp,"%%%%EndProlog\n");
if (!epsflag) {
fprintf(tfp,"%%%%Page: 1 1\n");
fprintf(tfp, "%%%%BeginPageSetup\n");
+ fprintf(tfp,"pageheader\n");
if (landscape)
fprintf(tfp, " 90 rotate\n");
/* increasing y goes down */
fprintf(tfp, "1 -1 scale\n");
fprintf(tfp, "%%%%EndPageSetup\n");
+ } else {
+ fprintf(tfp,"pageheader\n");
}
}
@@ -982,6 +998,7 @@
/* for multipage, translate and output objects for each page */
if (multi_page) {
+ fprintf(tfp,"%%%%EndProlog\n");
page = 1;
if (overlap)
mul = 0.9;
@@ -994,6 +1011,7 @@
for (dx=0; (dx < (furx-w*0.1)) || (page == 1); dx += w*mul) {
fprintf(tfp, "%%%%Page: %d %d\n",page,page);
+ fprintf(tfp, "pageheader\n",page,page);
/* do page rotation here */
fprintf(tfp, "%%%%BeginPageSetup\n");
if (landscape) {
@@ -1015,6 +1033,7 @@
fprintf(tfp, "\n");
}
fprintf(tfp, "gr\n");
+ fprintf(tfp, "pagefooter\n");
fprintf(tfp, "showpage\n");
page++;
}
@@ -1023,14 +1042,11 @@
/* Close the (last) figure */
do_split(-10);
- fprintf(tfp, "$F2psEnd\n");
- fprintf(tfp, "rs\n");
-
- if (pats_used)
- fprintf(tfp, "end\n"); /* close off MyAppDict */
/* add showpage if requested */
- if (!multi_page)
+ if (!multi_page) {
+ fprintf(tfp, "pagefooter\n");
fprintf(tfp, "showpage\n");
+ }
/* does the user want an ASCII or TIFF preview? */
if (tiffpreview || asciipreview) {
@@ -1104,6 +1120,8 @@
}
/* put any cleanup between %%Trailer and %EOF */
fprintf(tfp, "%%%%Trailer\n");
+ if (pats_used)
+ fprintf(tfp, "end\n"); /* close off MyAppDict */
/* final DSC comment for eps output (EOF = end of document) */
fprintf(tfp, "%%EOF\n");
signature.asc
Description: Digital signature

