From 13ce1875e06400d6ba5e3db3127fbf70a623f675 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Oct 11 2013 15:37:56 +0000 Subject: Additional fix for landscape printing for PDFs (bug #768811). Resolves: rhbz#768811 --- diff --git a/cups-filters-pdf-landscape.patch b/cups-filters-pdf-landscape.patch index a3df684..2e13d73 100644 --- a/cups-filters-pdf-landscape.patch +++ b/cups-filters-pdf-landscape.patch @@ -1,41 +1,76 @@ +diff -up cups-filters-1.0.38/Makefile.am.pdf-landscape cups-filters-1.0.38/Makefile.am +--- cups-filters-1.0.38/Makefile.am.pdf-landscape 2013-08-21 18:28:24.000000000 +0100 ++++ cups-filters-1.0.38/Makefile.am 2013-10-11 16:32:35.800557792 +0100 +@@ -696,6 +696,10 @@ EXTRA_DIST += \ + distclean-local: + rm -rf *.cache *~ + ++install-exec-hook: ++ mkdir -p $(DESTDIR)$(pkgfilterdir) ++ ln -s pdftops$(EXEEXT) $(DESTDIR)$(pkgfilterdir)/convpdftops$(EXEEXT) ++ + install-data-hook: + if RCLINKS + for level in $(RCLEVELS); do \ diff -up cups-filters-1.0.38/filter/pdftops.c.pdf-landscape cups-filters-1.0.38/filter/pdftops.c --- cups-filters-1.0.38/filter/pdftops.c.pdf-landscape 2013-09-03 15:33:54.000000000 +0100 -+++ cups-filters-1.0.38/filter/pdftops.c 2013-09-17 14:58:59.460506475 +0100 -@@ -273,6 +273,7 @@ main(int argc, /* I - Number of comm ++++ cups-filters-1.0.38/filter/pdftops.c 2013-10-11 16:32:35.801557796 +0100 +@@ -272,6 +272,7 @@ main(int argc, /* I - Number of comm + *pstops_argv[7], /* Arguments for pstops filter */ *pstops_options, /* Options for pstops filter */ *pstops_end; /* End of pstops filter option */ ++ const char *cmd; /* Pointer to basename of argv[0] */ const char *cups_serverbin; /* CUPS_SERVERBIN environment variable */ -+ const char *content_type; /* CONTENT_TYPE environment variable */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ - #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ -@@ -438,6 +439,7 @@ main(int argc, /* I - Number of comm +@@ -438,6 +439,16 @@ main(int argc, /* I - Number of comm * Build the command-line for the pdftops or gs filter... */ -+ content_type = getenv("CONTENT_TYPE"); ++ if (argv[0]) ++ { ++ cmd = strrchr (argv[0], '/'); ++ if (cmd) ++ cmd++; ++ } ++ ++ if (!cmd) ++ cmd = "pdftops"; ++ if (renderer == PDFTOPS) { pdf_argv[0] = (char *)"pdftops"; -@@ -630,7 +632,9 @@ main(int argc, /* I - Number of comm +@@ -630,7 +641,9 @@ main(int argc, /* I - Number of comm * which contain pages of different sizes can be printed correctly */ - pdf_argv[pdf_argc++] = (char *)"-origpagesizes"; + /* Only do this for unprocessed PDF files */ -+ if (content_type && !strstr (content_type, "/vnd.cups-")) ++ if (!strcmp (cmd, "pdftops")) + pdf_argv[pdf_argc++] = (char *)"-origpagesizes"; } #endif /* HAVE_POPPLER_PDFTOPS_WITH_ORIGPAGESIZES */ else if (renderer == ACROREAD) -@@ -640,7 +644,9 @@ main(int argc, /* I - Number of comm +@@ -640,7 +653,9 @@ main(int argc, /* I - Number of comm * which contain pages of different sizes can be printed correctly */ - pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize"; + /* Only do this for unprocessed PDF files */ -+ if (content_type && !strstr (content_type, "/vnd.cups-")) ++ if (!strcmp (cmd, "pdftops")) + pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize"; } /* +diff -up cups-filters-1.0.38/mime/cupsfilters.convs.pdf-landscape cups-filters-1.0.38/mime/cupsfilters.convs +--- cups-filters-1.0.38/mime/cupsfilters.convs.pdf-landscape 2013-08-20 22:36:54.000000000 +0100 ++++ cups-filters-1.0.38/mime/cupsfilters.convs 2013-10-11 16:32:35.801557796 +0100 +@@ -76,7 +76,7 @@ image/urf application/pdf 0 urftopdf + # + + #application/pdf application/vnd.cups-postscript 66 pdftops +-application/vnd.cups-pdf application/vnd.cups-postscript 100 pdftops ++application/vnd.cups-pdf application/vnd.cups-postscript 100 convpdftops + #application/postscript application/vnd.cups-postscript 66 pstops + + ######################################################################## diff --git a/cups-filters.spec b/cups-filters.spec index 116d32d..d79143f 100644 --- a/cups-filters.spec +++ b/cups-filters.spec @@ -4,7 +4,7 @@ Summary: OpenPrinting CUPS filters and backends Name: cups-filters Version: 1.0.38 -Release: 3%{?dist} +Release: 4%{?dist} # For a breakdown of the licensing, see COPYING file # GPLv2: filters: commandto*, imagetoraster, pdftops, rasterto*, @@ -184,7 +184,15 @@ fi %doc __doc/README __doc/AUTHORS __doc/NEWS %config(noreplace) %{_sysconfdir}/cups/cups-browsed.conf %config(noreplace) %{_sysconfdir}/fonts/conf.d/99pdftoopvp.conf -%attr(0755,root,root) %{_cups_serverbin}/filter/* +%attr(0755,root,root) %{_cups_serverbin}/filter/bannerto* +%attr(0755,root,root) %{_cups_serverbin}/filter/commandto* +%attr(0755,root,root) %{_cups_serverbin}/filter/imageto* +%attr(0755,root,root) %{_cups_serverbin}/filter/pdfto* +%attr(0755,root,root) %{_cups_serverbin}/filter/psto* +%attr(0755,root,root) %{_cups_serverbin}/filter/rasterto* +%attr(0755,root,root) %{_cups_serverbin}/filter/text* +%attr(0755,root,root) %{_cups_serverbin}/filter/urfto* +%{_cups_serverbin}/filter/convpdftops %attr(0755,root,root) %{_cups_serverbin}/backend/parallel # Serial backend needs to run as root (bug #212577#c4). %attr(0700,root,root) %{_cups_serverbin}/backend/serial @@ -217,6 +225,9 @@ fi %{_libdir}/libfontembed.so %changelog +* Thu Oct 10 2013 Tim Waugh - 1.0.38-4 +- Additional fix for landscape printing for PDFs (bug #768811). + * Tue Oct 1 2013 Tim Waugh - 1.0.38-3 - Fixes for some printf-type format mismatches (bug #1014093).