cups-filters/cups-filters-pdf-landscape.patch
2013-09-17 15:38:28 +01:00

42 lines
1.8 KiB
Diff

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
*pstops_options, /* Options for pstops filter */
*pstops_end; /* End of pstops filter option */
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
* Build the command-line for the pdftops or gs filter...
*/
+ content_type = getenv("CONTENT_TYPE");
if (renderer == PDFTOPS)
{
pdf_argv[0] = (char *)"pdftops";
@@ -630,7 +632,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-"))
+ 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
* 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-"))
+ pdf_argv[pdf_argc++] = (char *)"-choosePaperByPDFPageSize";
}
/*