if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
- _("Usage: %s job-id user title copies options [file]\n"),
+ _("Usage: %s job-id user title copies options file"),
argv[0]);
return (1);
}
if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
{
- _cupsLangPrintf(stderr, _("ERROR: Unable to open file \"%s\" - %s\n"),
- argv[6], strerror(errno));
+ _cupsLangPrintError("ERROR", _("Unable to open print file"));
return (1);
}
}
if (!doc->pages)
{
- _cupsLangPrintf(stderr,
- _("EMERG: Unable to allocate memory for pages array: %s\n"),
- strerror(errno));
+ _cupsLangPrintError("EMERG", _("Unable to allocate memory for pages array"));
exit(1);
}
if ((pageinfo = calloc(1, sizeof(pstops_page_t))) == NULL)
{
- _cupsLangPrintf(stderr,
- _("EMERG: Unable to allocate memory for page info: %s\n"),
- strerror(errno));
+ _cupsLangPrintError("EMERG", _("Unable to allocate memory for page info"));
exit(1);
}
if (cupsFileSeek(fp, offset) < 0)
{
- _cupsLangPrintf(stderr,
-#ifdef HAVE_LONG_LONG
- _("ERROR: Unable to seek to offset %lld in file - %s\n"),
-#else
- _("ERROR: Unable to seek to offset %ld in file - %s\n"),
-#endif /* HAVE_LONG_LONG */
- CUPS_LLCAST offset, strerror(errno));
+ _cupsLangPrintError("ERROR", _("Unable to see in file"));
return;
}
if (bytes > sizeof(buffer))
{
- _cupsLangPrintf(stderr,
- _("ERROR: doc_printf overflow (%d bytes) detected, "
- "aborting\n"), (int)bytes);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Buffer overflow detected, aborting."));
exit(1);
}
if ((option = ppdFindOption(ppd, name + 1)) == NULL)
{
- _cupsLangPrintf(stderr, _("WARNING: Unknown option \"%s\"\n"), name + 1);
+ _cupsLangPrintFilter(stderr, "WARNING", _("Unknown option \"%s\"."),
+ name + 1);
return (num_options);
}
if (option->section == PPD_ORDER_EXIT ||
option->section == PPD_ORDER_JCL)
{
- _cupsLangPrintf(stderr, _("WARNING: Option \"%s\" cannot be included via "
- "IncludeFeature\n"), name + 1);
+ _cupsLangPrintFilter(stderr, "WARNING",
+ _("Option \"%s\" cannot be included via "
+ "%%%%IncludeFeature."), name + 1);
return (num_options);
}
if (!ppdFindChoice(option, value))
{
- _cupsLangPrintf(stderr,
- _("WARNING: Unknown choice \"%s\" for option \"%s\"\n"),
- value, name + 1);
+ _cupsLangPrintFilter(stderr, "WARNING",
+ _("Unknown choice \"%s\" for option \"%s\"."),
+ value, name + 1);
return (num_options);
}
ppd_attr_t *attr; /* PPD attribute */
ppd_option_t *option; /* PPD option */
ppd_choice_t *choice; /* PPD choice */
+ const char *content_type; /* Original content type */
/*
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
doc->page_size = choice->choice;
-
/*
* brightness
*/
if (intval < 10 || intval > 1000)
{
- _cupsLangPrintf(stderr, _("ERROR: Unsupported brightness value %s, using "
- "brightness=100\n"), val);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unsupported brightness value %s, using "
+ "brightness=100."), val);
doc->brightness = 1.0f;
}
else
doc->emit_jcl = 1;
/*
- * fitplot/fit-to-page
+ * fitplot/fit-to-page/ipp-attribute-fidelity
+ *
+ * (Only for original PostScript content)
*/
- if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
- !strcasecmp(val, "true"))
- doc->fitplot = 1;
- else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
- !strcasecmp(val, "true"))
- doc->fitplot = 1;
+ if ((content_type = getenv("CONTENT_TYPE")) == NULL)
+ content_type = "application/postscript";
+
+ if (!strcasecmp(content_type, "application/postscript"))
+ {
+ if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ else if ((val = cupsGetOption("ipp-attribute-fidelity", num_options,
+ options)) != NULL &&
+ !strcasecmp(val, "true"))
+ doc->fitplot = 1;
+ }
/*
* gamma
if (intval < 1 || intval > 10000)
{
- _cupsLangPrintf(stderr, _("ERROR: Unsupported gamma value %s, using "
- "gamma=1000\n"), val);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unsupported gamma value %s, using gamma=1000."),
+ val);
doc->gamma = 1.0f;
}
else
doc->number_up = intval;
break;
default :
- _cupsLangPrintf(stderr,
- _("ERROR: Unsupported number-up value %d, using "
- "number-up=1\n"), intval);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unsupported number-up value %d, using "
+ "number-up=1."), intval);
doc->number_up = 1;
break;
}
doc->number_up_layout = PSTOPS_LAYOUT_BTRL;
else
{
- _cupsLangPrintf(stderr, _("ERROR: Unsupported number-up-layout value %s, "
- "using number-up-layout=lrtb\n"), val);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unsupported number-up-layout value %s, using "
+ "number-up-layout=lrtb."), val);
doc->number_up_layout = PSTOPS_LAYOUT_LRTB;
}
}
doc->page_border = PSTOPS_BORDERDOUBLE2;
else
{
- _cupsLangPrintf(stderr, _("ERROR: Unsupported page-border value %s, "
- "using page-border=none\n"), val);
+ _cupsLangPrintFilter(stderr, "ERROR",
+ _("Unsupported page-border value %s, using "
+ "page-border=none."), val);
doc->page_border = PSTOPS_BORDERNONE;
}
}
else if (doc->number_up > 1 || doc->fitplot)
doc_printf(doc, "%.1f %.1f translate\n", PageLeft, PageBottom);
- if (doc->mirror)
- doc_printf(doc, "%.1f 0.0 translate -1 1 scale\n", PageWidth);
-
switch (doc->number_up)
{
default :
bboxx + margin, bboxy + margin,
bboxw - 2 * margin, bboxl - 2 * margin);
}
+
+ /*
+ * Mirror the page as needed...
+ */
+
+ if (doc->mirror)
+ doc_printf(doc, "%.1f 0.0 translate -1 1 scale\n", PageWidth);
}