/*
- * "$Id: pstops.c 7977 2008-09-23 23:44:33Z mike $"
+ * "$Id$"
*
- * PostScript filter for CUPS.
+ * PostScript filter for CUPS.
*
- * Copyright 2007-2011 by Apple Inc.
- * Copyright 1993-2007 by Easy Software Products.
+ * Copyright 2007-2014 by Apple Inc.
+ * Copyright 1993-2007 by Easy Software Products.
*
- * These coded instructions, statements, and computer programs are the
- * property of Apple Inc. and are protected by Federal copyright
- * law. Distribution and use rights are outlined in the file "LICENSE.txt"
- * which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
- * This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- * main() - Main entry.
- * add_page() - Add a page to the pages array.
- * cancel_job() - Flag the job as canceled.
- * check_range() - Check to see if the current page is selected for
- * printing.
- * copy_bytes() - Copy bytes from the input file to stdout.
- * copy_comments() - Copy all of the comments section.
- * copy_dsc() - Copy a DSC-conforming document.
- * copy_non_dsc() - Copy a document that does not conform to the DSC.
- * copy_page() - Copy a page description.
- * copy_prolog() - Copy the document prolog section.
- * copy_setup() - Copy the document setup section.
- * copy_trailer() - Copy the document trailer.
- * do_prolog() - Send the necessary document prolog commands.
- * do_setup() - Send the necessary document setup commands.
- * doc_printf() - Send a formatted string to stdout and/or the temp
- * file.
- * doc_puts() - Send a nul-terminated string to stdout and/or the
- * temp file.
- * doc_write() - Send data to stdout and/or the temp file.
- * end_nup() - End processing for N-up printing.
- * include_feature() - Include a printer option/feature command.
- * parse_text() - Parse a text value in a comment.
- * set_pstops_options() - Set pstops options.
- * skip_page() - Skip past a page that won't be printed.
- * start_nup() - Start processing for N-up printing.
- * write_label_prolog() - Write the prolog with the classification and page
- * label.
- * write_labels() - Write the actual page labels.
- * write_options() - Write options provided via %%IncludeFeature.
+ * This file is subject to the Apple OS-Developed Software exception.
*/
/*
*ap_media_type, /* AP_FIRSTPAGE_MediaType value */
*ap_page_region, /* AP_FIRSTPAGE_PageRegion value */
*ap_page_size; /* AP_FIRSTPAGE_PageSize value */
- float brightness; /* brightness value */
int collate, /* Collate copies? */
emit_jcl, /* Emit JCL commands? */
- fitplot; /* Fit pages to media */
- float gamma; /* gamma value */
+ fit_to_page; /* Fit pages to media */
const char *input_slot, /* InputSlot value */
*manual_feed, /* ManualFeed value */
*media_color, /* MediaColor value */
int num_options; /* Number of print options */
cups_option_t *options; /* Print options */
char line[8192]; /* Line buffer */
- size_t len; /* Length of line buffer */
+ ssize_t len; /* Length of line buffer */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
if (argc < 6 || argc > 7)
{
_cupsLangPrintf(stderr,
- _("Usage: %s job-id user title copies options file"),
+ _("Usage: %s job-id user title copies options [file]"),
argv[0]);
return (1);
}
if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
{
- _cupsLangPrintError("ERROR", _("Unable to open print file"));
+ if (!JobCanceled)
+ _cupsLangPrintError("ERROR", _("Unable to open print file"));
return (1);
}
}
* Read the first line to see if we have DSC comments...
*/
- if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
+ if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
{
fputs("DEBUG: The print file is empty.\n", stderr);
return (1);
fputs("DEBUG: Skipping PJL header...\n", stderr);
while (strstr(line, "ENTER LANGUAGE") == NULL && strncmp(line, "%!", 2))
- if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
+ if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
break;
if (!strncmp(line, "%!", 2))
break;
- if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
+ if ((len = (ssize_t)cupsFileGetLine(fp, line, sizeof(line))) == 0)
break;
}
{
lower = 1;
range ++;
- upper = strtol(range, (char **)&range, 10);
+ upper = (int)strtol(range, (char **)&range, 10);
}
else
{
- lower = strtol(range, (char **)&range, 10);
+ lower = (int)strtol(range, (char **)&range, 10);
if (*range == '-')
{
if (!isdigit(*range & 255))
upper = 65535;
else
- upper = strtol(range, (char **)&range, 10);
+ upper = (int)strtol(range, (char **)&range, 10);
}
else
upper = lower;
if (nleft > sizeof(buffer) || length == 0)
nbytes = sizeof(buffer);
else
- nbytes = nleft;
+ nbytes = (ssize_t)nleft;
- if ((nbytes = cupsFileRead(fp, buffer, nbytes)) < 1)
+ if ((nbytes = cupsFileRead(fp, buffer, (size_t)nbytes)) < 1)
return;
- nleft -= nbytes;
+ nleft -= (size_t)nbytes;
- fwrite(buffer, 1, nbytes, stdout);
+ fwrite(buffer, 1, (size_t)nbytes, stdout);
}
}
}
else if (!strcmp(line, "%%EndComments"))
{
- linelen = cupsFileGetLine(fp, line, linesize);
+ linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
break;
}
else if (strncmp(line, "%!", 2) && strncmp(line, "%cups", 5))
doc_printf(doc, "%s\n", line);
- if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
+ if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
while (strncmp(line, "%%Page:", 7) && strncmp(line, "%%Trailer", 9))
{
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
- if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
+ if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
doc_puts(doc, "showpage\n");
end_nup(doc, doc->number_up);
- pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
+ pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
}
if (doc->slow_duplex && (doc->page & 1))
doc_puts(doc, "showpage\n");
end_nup(doc, doc->number_up);
- pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
+ pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
}
/*
puts("%%Trailer");
printf("%%%%Pages: %d\n", cupsArrayCount(doc->pages));
- if (doc->number_up > 1 || doc->fitplot)
+ if (doc->number_up > 1 || doc->fit_to_page)
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n",
PageLeft, PageBottom, PageRight, PageTop);
else
if (!number)
{
pageinfo = (pstops_page_t *)cupsArrayFirst(doc->pages);
- copy_bytes(doc->temp, 0, pageinfo->offset);
+ copy_bytes(doc->temp, 0, (size_t)pageinfo->offset);
}
/*
pageinfo->bounding_box[2], pageinfo->bounding_box[3]);
}
- copy_bytes(doc->temp, pageinfo->offset, pageinfo->length);
+ copy_bytes(doc->temp, pageinfo->offset, (size_t)pageinfo->length);
pageinfo = doc->slow_order ? (pstops_page_t *)cupsArrayPrev(doc->pages) :
(pstops_page_t *)cupsArrayNext(doc->pages);
ssize_t linelen, /* I - Length of initial line */
size_t linesize) /* I - Size of line buffer */
{
- int copy; /* Current copy */
- char buffer[8192]; /* Copy buffer */
- int bytes; /* Number of bytes copied */
+ int copy; /* Current copy */
+ char buffer[8192]; /* Copy buffer */
+ ssize_t bytes; /* Number of bytes copied */
+
+ (void)linesize;
/*
* First let the user know that they are attempting to print a file
puts("%%EndPageSetup");
puts("%%BeginDocument: nondsc");
- fwrite(line, linelen, 1, stdout);
+ fwrite(line, (size_t)linelen, 1, stdout);
if (doc->temp)
- cupsFileWrite(doc->temp, line, linelen);
+ cupsFileWrite(doc->temp, line, (size_t)linelen);
while ((bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
{
- fwrite(buffer, 1, bytes, stdout);
+ fwrite(buffer, 1, (size_t)bytes, stdout);
if (doc->temp)
- cupsFileWrite(doc->temp, buffer, bytes);
+ cupsFileWrite(doc->temp, buffer, (size_t)bytes);
}
puts("%%EndDocument");
if (doc->ap_input_slot || doc->ap_manual_feed)
{
- if (doc->page == 1)
+ if ((doc->page == 1 && (!doc->slow_order || !Duplex)) ||
+ (doc->page == 2 && doc->slow_order && Duplex))
{
/*
* First page/sheet gets AP_FIRSTPAGE_* options...
memcpy(bounding_box, doc->bounding_box, sizeof(bounding_box));
- while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
+ while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%PageBoundingBox:", 18))
{
memcpy(bounding_box, doc->bounding_box,
sizeof(bounding_box));
}
- else if (doc->number_up == 1 && !doc->fitplot && Orientation)
+ else if (doc->number_up == 1 && !doc->fit_to_page && Orientation)
{
int temp_bbox[4]; /* Temporary bounding box */
switch (Orientation)
{
case 1 : /* Landscape */
- bounding_box[0] = PageLength - temp_bbox[3];
+ bounding_box[0] = (int)(PageLength - temp_bbox[3]);
bounding_box[1] = temp_bbox[0];
- bounding_box[2] = PageLength - temp_bbox[1];
+ bounding_box[2] = (int)(PageLength - temp_bbox[1]);
bounding_box[3] = temp_bbox[2];
break;
case 2 : /* Reverse Portrait */
- bounding_box[0] = PageWidth - temp_bbox[2];
- bounding_box[1] = PageLength - temp_bbox[3];
- bounding_box[2] = PageWidth - temp_bbox[0];
- bounding_box[3] = PageLength - temp_bbox[1];
+ bounding_box[0] = (int)(PageWidth - temp_bbox[2]);
+ bounding_box[1] = (int)(PageLength - temp_bbox[3]);
+ bounding_box[2] = (int)(PageWidth - temp_bbox[0]);
+ bounding_box[3] = (int)(PageLength - temp_bbox[1]);
break;
case 3 : /* Reverse Landscape */
bounding_box[0] = temp_bbox[1];
- bounding_box[1] = PageWidth - temp_bbox[2];
+ bounding_box[1] = (int)(PageWidth - temp_bbox[2]);
bounding_box[2] = temp_bbox[3];
- bounding_box[3] = PageWidth - temp_bbox[0];
+ bounding_box[3] = (int)(PageWidth - temp_bbox[0]);
break;
}
* %%IncludeFeature: *MainKeyword OptionKeyword
*/
- if (doc->number_up == 1 &&!doc->fitplot)
+ if (doc->number_up == 1 &&!doc->fit_to_page)
pageinfo->num_options = include_feature(ppd, line,
pageinfo->num_options,
&(pageinfo->options));
{
int feature = 0; /* In a Begin/EndFeature block? */
- while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
+ while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%EndPageSetup", 14))
break;
{
feature = 1;
- if (doc->number_up > 1 || doc->fitplot)
+ if (doc->number_up > 1 || doc->fit_to_page)
continue;
}
else if (!strncmp(line, "%%EndFeature", 12))
{
feature = 0;
- if (doc->number_up > 1 || doc->fitplot)
+ if (doc->number_up > 1 || doc->fit_to_page)
continue;
}
else if (!strncmp(line, "%%IncludeFeature:", 17))
if (line[0] != '%' && !feature)
break;
- if (!feature || (doc->number_up == 1 && !doc->fitplot))
- doc_write(doc, line, linelen);
+ if (!feature || (doc->number_up == 1 && !doc->fit_to_page))
+ doc_write(doc, line, (size_t)linelen);
}
/*
*/
if (linelen > 0 && !strncmp(line, "%%EndPageSetup", 14))
- linelen = cupsFileGetLine(fp, line, linesize);
+ linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
}
if (first_page)
else if (!strncmp(line, "%%BeginDocument", 15) ||
!strncmp(line, "%ADO_BeginApplication", 21))
{
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
level ++;
}
else if ((!strncmp(line, "%%EndDocument", 13) ||
!strncmp(line, "%ADO_EndApplication", 19)) && level > 0)
{
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
level --;
}
int bytes; /* Bytes of data */
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
bytes = atoi(strchr(line, ':') + 1);
while (bytes > 0)
{
- if (bytes > linesize)
+ if ((size_t)bytes > linesize)
linelen = cupsFileRead(fp, line, linesize);
else
- linelen = cupsFileRead(fp, line, bytes);
+ linelen = cupsFileRead(fp, line, (size_t)bytes);
if (linelen < 1)
{
return (0);
}
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
bytes -= linelen;
}
}
else
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
}
- while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0);
+ while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0);
/*
* Finish up this page and return...
end_nup(doc, number);
- pageinfo->length = cupsFileTell(doc->temp) - pageinfo->offset;
+ pageinfo->length = (ssize_t)(cupsFileTell(doc->temp) - pageinfo->offset);
return (linelen);
}
if (!strncmp(line, "%%BeginSetup", 12) || !strncmp(line, "%%Page:", 7))
break;
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
- if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
+ if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
if (!strncmp(line, "%%BeginProlog", 13))
{
- while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
+ while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (!strncmp(line, "%%EndProlog", 11) ||
!strncmp(line, "%%BeginSetup", 12) ||
!strncmp(line, "%%Page:", 7))
break;
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
}
if (!strncmp(line, "%%EndProlog", 11))
- linelen = cupsFileGetLine(fp, line, linesize);
+ linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
else
fputs("DEBUG: The %%EndProlog comment is missing.\n", stderr);
}
if (!strncmp(line, "%%Page:", 7))
break;
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
- if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
+ if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
* %%IncludeFeature: *MainKeyword OptionKeyword
*/
- if (doc->number_up == 1 && !doc->fitplot)
+ if (doc->number_up == 1 && !doc->fit_to_page)
num_options = include_feature(ppd, line, num_options, &options);
}
else if (strncmp(line, "%%BeginSetup", 12))
- doc_write(doc, line, linelen);
+ doc_write(doc, line, (size_t)linelen);
- if ((linelen = cupsFileGetLine(fp, line, linesize)) == 0)
+ if ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) == 0)
break;
}
if (!strncmp(line, "%%EndSetup", 10))
- linelen = cupsFileGetLine(fp, line, linesize);
+ linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
else
fputs("DEBUG: The %%EndSetup comment is missing.\n", stderr);
}
* Write the trailer comments...
*/
+ (void)ppd;
+
puts("%%Trailer");
while (linelen > 0)
else if (strncmp(line, "%%Trailer", 9) &&
strncmp(line, "%%Pages:", 8) &&
strncmp(line, "%%BoundingBox:", 14))
- fwrite(line, 1, linelen, stdout);
+ fwrite(line, 1, (size_t)linelen, stdout);
- linelen = cupsFileGetLine(fp, line, linesize);
+ linelen = (ssize_t)cupsFileGetLine(fp, line, linesize);
}
fprintf(stderr, "DEBUG: Wrote %d pages...\n", number);
printf("%%%%Pages: %d\n", number);
- if (doc->number_up > 1 || doc->fitplot)
+ if (doc->number_up > 1 || doc->fit_to_page)
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n",
PageLeft, PageBottom, PageRight, PageTop);
else
doc_puts(doc, "userdict/setpagedevice{pop}bind put\n");
}
- /*
- * Changes to the transfer function must be made AFTER any
- * setpagedevice code...
- */
-
- if (doc->gamma != 1.0f || doc->brightness != 1.0f)
- doc_printf(doc, "{ neg 1 add dup 0 lt { pop 1 } { %.3f exp neg 1 add } "
- "ifelse %.3f mul } bind settransfer\n",
- doc->gamma, doc->brightness);
-
/*
* Make sure we have rectclip and rectstroke procedures of some sort...
*/
{
va_list ap; /* Pointer to arguments */
char buffer[1024]; /* Output buffer */
- size_t bytes; /* Number of bytes to write */
+ ssize_t bytes; /* Number of bytes to write */
va_start(ap, format);
bytes = vsnprintf(buffer, sizeof(buffer), format, ap);
va_end(ap);
- if (bytes > sizeof(buffer))
+ if ((size_t)bytes > sizeof(buffer))
{
_cupsLangPrintFilter(stderr, "ERROR",
_("Buffer overflow detected, aborting."));
exit(1);
}
- doc_write(doc, buffer, bytes);
+ doc_write(doc, buffer, (size_t)bytes);
}
ppd_option_t *option; /* PPD option */
ppd_choice_t *choice; /* PPD choice */
const char *content_type; /* Original content type */
+ int max_copies; /* Maximum number of copies supported */
/*
if ((choice = ppdFindMarkedChoice(ppd, "PageSize")) != NULL)
doc->page_size = choice->choice;
- /*
- * brightness
- */
-
- if ((val = cupsGetOption("brightness", num_options, options)) != NULL)
- {
- /*
- * Get brightness value from 10 to 1000.
- */
-
- intval = atoi(val);
-
- if (intval < 10 || intval > 1000)
- {
- _cupsLangPrintFilter(stderr, "ERROR",
- _("Unsupported brightness value %s, using "
- "brightness=100."), val);
- doc->brightness = 1.0f;
- }
- else
- doc->brightness = intval * 0.01f;
- }
- else
- doc->brightness = 1.0f;
-
/*
* collate, multiple-document-handling
*/
doc->emit_jcl = 1;
/*
- * fitplot/fit-to-page/ipp-attribute-fidelity
+ * fit-to-page/ipp-attribute-fidelity
*
* (Only for original PostScript content)
*/
if (!_cups_strcasecmp(content_type, "application/postscript"))
{
- if ((val = cupsGetOption("fitplot", num_options, options)) != NULL &&
+ if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
!_cups_strcasecmp(val, "true"))
- doc->fitplot = 1;
- else if ((val = cupsGetOption("fit-to-page", num_options, options)) != NULL &&
- !_cups_strcasecmp(val, "true"))
- doc->fitplot = 1;
+ doc->fit_to_page = 1;
else if ((val = cupsGetOption("ipp-attribute-fidelity", num_options,
options)) != NULL &&
!_cups_strcasecmp(val, "true"))
- doc->fitplot = 1;
- }
-
- /*
- * gamma
- */
-
- if ((val = cupsGetOption("gamma", num_options, options)) != NULL)
- {
- /*
- * Get gamma value from 1 to 10000...
- */
-
- intval = atoi(val);
-
- if (intval < 1 || intval > 10000)
- {
- _cupsLangPrintFilter(stderr, "ERROR",
- _("Unsupported gamma value %s, using gamma=1000."),
- val);
- doc->gamma = 1.0f;
- }
- else
- doc->gamma = intval * 0.001f;
+ doc->fit_to_page = 1;
}
- else
- doc->gamma = 1.0f;
/*
* mirror/MirrorPrint
* Now figure out if we have to force collated copies, etc.
*/
- if (ppd && ppd->manual_copies && Duplex && doc->copies > 1)
+ if ((attr = ppdFindAttr(ppd, "cupsMaxCopies", NULL)) != NULL)
+ max_copies = atoi(attr->value);
+ else if (ppd && ppd->manual_copies)
+ max_copies = 1;
+ else
+ max_copies = 9999;
+
+ if (doc->copies > max_copies)
+ doc->collate = 1;
+ else if (ppd && ppd->manual_copies && Duplex && doc->copies > 1)
{
/*
* Force collated copies when printing a duplexed document to
doc->slow_collate = 1;
- if ((choice = ppdFindMarkedChoice(ppd, "Collate")) != NULL &&
+ if (doc->copies <= max_copies &&
+ (choice = ppdFindMarkedChoice(ppd, "Collate")) != NULL &&
!_cups_strcasecmp(choice->choice, "True"))
{
/*
level = 0;
- while ((linelen = cupsFileGetLine(fp, line, linesize)) > 0)
+ while ((linelen = (ssize_t)cupsFileGetLine(fp, line, linesize)) > 0)
{
if (level == 0 &&
(!strncmp(line, "%%Page:", 7) || !strncmp(line, "%%Trailer", 9)))
* Skip binary data...
*/
- int bytes; /* Bytes of data */
-
+ ssize_t bytes; /* Bytes of data */
bytes = atoi(strchr(line, ':') + 1);
while (bytes > 0)
{
- if (bytes > linesize)
- linelen = cupsFileRead(fp, line, linesize);
+ if ((size_t)bytes > linesize)
+ linelen = (ssize_t)cupsFileRead(fp, line, linesize);
else
- linelen = cupsFileRead(fp, line, bytes);
+ linelen = (ssize_t)cupsFileRead(fp, line, (size_t)bytes);
if (linelen < 1)
{
{
int pos; /* Position on page */
int x, y; /* Relative position of subpage */
- float w, l, /* Width and length of subpage */
+ double w, l, /* Width and length of subpage */
tx, ty; /* Translation values for subpage */
- float pagew, /* Printable width of page */
+ double pagew, /* Printable width of page */
pagel; /* Printable height of page */
int bboxx, /* BoundingBox X origin */
bboxy, /* BoundingBox Y origin */
bboxw, /* BoundingBox width */
bboxl; /* BoundingBox height */
- float margin = 0; /* Current margin for border */
+ double margin = 0; /* Current margin for border */
if (doc->number_up > 1)
pagew = PageRight - PageLeft;
pagel = PageTop - PageBottom;
- if (doc->fitplot)
+ if (doc->fit_to_page)
{
bboxx = bounding_box[0];
bboxy = bounding_box[1];
{
bboxx = 0;
bboxy = 0;
- bboxw = PageWidth;
- bboxl = PageLength;
+ bboxw = (int)PageWidth;
+ bboxl = (int)PageLength;
}
fprintf(stderr, "DEBUG: pagew = %.1f, pagel = %.1f\n", pagew, pagel);
doc_printf(doc, "%.1f 0.0 translate -1 1 scale\n", PageWidth);
/*
- * Offset and scale as necessary for fitplot/fit-to-page/number-up...
+ * Offset and scale as necessary for fit_to_page/fit-to-page/number-up...
*/
if (Duplex && doc->number_up > 1 && ((number / doc->number_up) & 1))
doc_printf(doc, "%.1f %.1f translate\n", PageWidth - PageRight, PageBottom);
- else if (doc->number_up > 1 || doc->fitplot)
+ else if (doc->number_up > 1 || doc->fit_to_page)
doc_printf(doc, "%.1f %.1f translate\n", PageLeft, PageBottom);
switch (doc->number_up)
{
default :
- if (doc->fitplot)
+ if (doc->fit_to_page)
{
w = pagew;
l = w * bboxl / bboxw;
if (doc->page_border && show_border)
{
int rects; /* Number of border rectangles */
- float fscale; /* Scaling value for points */
+ double fscale; /* Scaling value for points */
rects = (doc->page_border & PSTOPS_BORDERDOUBLE) ? 2 : 1;
doc_puts(doc, "grestore\n");
}
- if (doc->fitplot)
+ if (doc->fit_to_page)
{
/*
* Offset the page by its bounding box...
-bounding_box[1]);
}
- if (doc->fitplot || doc->number_up > 1)
+ if (doc->fit_to_page || doc->number_up > 1)
{
/*
* Clip the page to the page's bounding box...
{
int i; /* Looping var */
ppd_option_t *option; /* PPD option */
- int min_order; /* Minimum OrderDependency value */
+ float min_order; /* Minimum OrderDependency value */
char *doc_setup, /* DocumentSetup commands to send */
*any_setup; /* AnySetup commands to send */
/*
- * End of "$Id: pstops.c 7977 2008-09-23 23:44:33Z mike $".
+ * End of "$Id$".
*/