[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#379378: working poster version 20050907 with Debian patches



Hi,

it took me quite a bit of time to figure out the various problems of
the newer poster versions (>=2002). The 1999 version (as shipped by
Debian) works more reliably as well for me (using, e.g.,
dvips-generated postscript). Unfortunately, the kdeprint dialog is
messed up (missing '-F' option), but one can still successfully use
the poster printing feature from within kdeprint!


Nevertheless, I did some work and created a poster package for version
20050907 with a few patches applied to it that, AFAICS, resolve the
bugs mentioned in the earlier posting by Peter. I could, for instance,
successfully check that #255718 is still fixed with it. Earlier patches
(libpaper, etc.) are also included.

The multi-page feature introduced in the 2002 version explicitly
counts "%%Page:" lines to select pages to print. This breaks printing
of posters produced with latex and dvips containing embedded EPS
figures. Although those postscript files are probably not
DSC-compliant, I am sure many Debian users (not only me) want to print
such (non-compliant) files. Therefore, I also included a patch that
disables the page counting (see lines 1032ff). This unfortunately
breaks multi-page printing.

I attach the patch to poster.c and send you, Peter, a adapted source
package.

cheers,

Daniel

-- 
-----------------------------------------------------------------
Daniel Hermann,      Institut fuer Theoretische Festkoerperphysik
Universitaet Karlsruhe                  Tel: ++49 (0)721 608-7328
Postfach 6980                           Fax: ++49 (0)721 608-7779
76128 Karlsruhe, Germany      email: hermann@tfp.uni-karlsruhe.de
-----------------------------------------------------------------
--- poster.c.20050907	2008-02-14 15:38:35.000000000 +0100
+++ poster.c	2008-02-14 14:51:12.000000000 +0100
@@ -42,10 +42,20 @@
 #  the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 #  Boston, MA 02111-1307, USA.
 #
+# Modification for Debian by Antti-Juhani Kaijanaho <ajk@debian.org>
+# on 1999-05-20
+# 
+# Adaptation of version 20050907 by Daniel Hermann <hermann@tfp.uka.de>
+#
 */
 
 #define Gv_gs_orientbug 1
-#define DefaultMedia  "A4"
+#ifdef HAVE_LIBPAPER
+#  include <paper.h>
+#  define DefaultMedia (systempapername())
+#else /* HAVE_LIBPAPER */
+#  define DefaultMedia  "A4"
+#endif /* HAVE_LIBPAPER */
 #define DefaultImage  "A4"
 #define DefaultCutMargin "5%"
 #define DefaultWhiteMargin "0"
@@ -955,6 +965,7 @@
 	        "tiledict begin\n"
 	        "%% delay users showpage until cropmark is printed.\n"
 	        "/showpage {} def\n"
+	        "/setpagedevice { pop } def\n"
 	        "end\n",
 	        scale, (int)(cutmargin[0]), (int)(cutmargin[1]),
 	        (int)(mediasize[2]-2.0*cutmargin[0]), (int)(mediasize[3]-2.0*cutmargin[1]),
@@ -1012,16 +1023,26 @@
 	/* fill first buffer for the first time */
 	fgets( buf[bp=0], BUFSIZE, stdin);
 
+/* DSC comment starts with %% and has at least 1 more character.  */
+#define IS_DSC(x) ( x[0]&&x[1]&&x[2] && (x[0]=='%')&&(x[1]=='%') )
+
 	/* read subsequent lines by rotating the buffers */
 	while (fgets(buf[1-bp], BUFSIZE, stdin))
 	{	
-		if ( !strncmp( buf[ bp ], "%%Page:", 7 ) )
-			currentpage++;
+	        /* We can not rely on DSC compliant input that correctly
+		   uses "%%Page:" comments. Embedded figures may also have
+		   such comments. So multi-page poster printing seems to be
+		   broken anyway. Break it a little more in favour of
+		   single-page posters until a better page separator is
+		   implemented (DH).
+		*/
+		/* if ( !strncmp( buf[ bp ], "%%Page:", 7 ) )
+			currentpage++; */
 
 		/* print line from the previous fgets */
 		/* do not print postscript comment lines: those (DSC) lines */
 		/* sometimes disturb proper previewing of the result with ghostview */
-		if (buf[bp][0] != '%' && ( currentpage == -1 || currentpage == pagetoprint ))
+		if (!IS_DSC(buf[bp]) && ( currentpage == -1 || currentpage == pagetoprint ))
 			fputs( buf[bp], stdout);
 		bp = 1-bp;
 	}
@@ -1032,8 +1053,9 @@
 	{	tail_cntl_D = 1;
 		*c = '\0';
 	}
-	if (buf[bp][0] != '%' && strlen( buf[bp]))
+	if (!IS_DSC(buf[bp]) && strlen( buf[bp]))
 		fputs( buf[bp], stdout);
+#undef IS_DSC
 }
 
 static int mystrncasecmp( const char *s1, const char *s2, int n)

Reply to: