-CHANGES.txt - 02/28/2003
+CHANGES.txt - 03/03/2003
------------------------
CHANGES IN CUPS V1.1.19
+ - The pdftops filter now scales PDF pages within the
+ printable area of the page.
- The pstops filter didn't include the page-label and
classification boxes when printing EPS or non-
conformant PS files.
psPaperWidth = defPaperWidth;
psPaperHeight = defPaperHeight;
#endif
+ psLeft = 0;
+ psBottom = 0;
+ psRight = psPaperWidth;
+ psTop = psPaperHeight;
psDuplex = gFalse;
psLevel = psLevel2;
psFile = NULL;
return s;
}
+void GlobalParams::getPSImageableArea(int &left, int &bottom, int &right, int &top) {
+ globalParamsLock;
+ left = psLeft;
+ bottom = psBottom;
+ right = psRight;
+ top = psTop;
+ globalParamsUnlock;
+}
+
+
int GlobalParams::getPSPaperWidth() {
int w;
globalParamsUnlock;
}
+void GlobalParams::setPSImageableArea(int left, int bottom, int right, int top) {
+ globalParamsLock;
+ psLeft = left;
+ psBottom = bottom;
+ psRight = right;
+ psTop = top;
+ globalParamsUnlock;
+}
+
GBool GlobalParams::setPSPaperSize(char *size) {
globalParamsLock;
if (!strcmp(size, "letter")) {
} else if (!strcmp(size, "A3")) {
psPaperWidth = 842;
psPaperHeight = 1190;
+ } else if (!strcmp(size, "Universal")) {
+ psPaperWidth = 595;
+ psPaperHeight = 792;
} else {
globalParamsUnlock;
return gFalse;
}
+ psLeft = 0;
+ psBottom = 0;
+ psRight = psPaperWidth;
+ psTop = psPaperHeight;
globalParamsUnlock;
return gTrue;
}
void GlobalParams::setPSPaperWidth(int width) {
globalParamsLock;
psPaperWidth = width;
+ psLeft = 0;
+ psRight = psPaperWidth;
globalParamsUnlock;
}
void GlobalParams::setPSPaperHeight(int height) {
globalParamsLock;
psPaperHeight = height;
+ psBottom = 0;
+ psTop = psPaperHeight;
globalParamsUnlock;
}
DisplayFontParam *getDisplayFont(GString *fontName);
DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
GString *getPSFile();
+ void getPSImageableArea(int &left, int &bottom, int &right, int &top);
int getPSPaperWidth();
int getPSPaperHeight();
GBool getPSDuplex();
void addDisplayFont(DisplayFontParam *param);
void setPSFile(char *file);
GBool setPSPaperSize(char *size);
+ void setPSImageableArea(int left, int bottom, int right, int top);
void setPSPaperWidth(int width);
void setPSPaperHeight(int height);
void setPSDuplex(GBool duplex);
GString *psFile; // PostScript file or command (for xpdf)
int psPaperWidth; // paper size, in PostScript points, for
int psPaperHeight; // PostScript output
+ int psLeft; // imageable area, in PostScript points,
+ int psBottom; // for PostScript output
+ int psRight; // ...
+ int psTop; // ...
GBool psDuplex; // enable duplexing in PostScript?
PSLevel psLevel; // PostScript level to generate
GHash *psFonts; // PostScript font info, indexed by PDF
writePSFmt("%%%%DocumentMedia: plain %d %d 0 () ()\n",
paperWidth, paperHeight);
writePSFmt("%%%%Pages: %d\n", lastPage - firstPage + 1);
+ writePSFmt("%%%%BoundingBox: 0 0 %d %d\n", paperWidth, paperHeight);
writePS("%%EndComments\n");
writePS("%%BeginDefaults\n");
writePS("%%PageMedia: plain\n");
void PSOutputDev::startPage(int pageNum, GfxState *state) {
int x1, y1, x2, y2, width, height, t;
+ int imageWidth, imageHeight;
+ int left, bottom, right, top;
+ globalParams->getPSImageableArea(left, bottom, right, top);
+ imageWidth = right - left;
+ imageHeight = top - bottom;
switch (mode) {
case psModePS:
writePSFmt("%%%%Page: %d %d\n", pageNum, seqPage);
- writePS("%%BeginPageSetup\n");
// rotate, translate, and scale page
x1 = (int)(state->getX1() + 0.5);
y1 = (int)(state->getY1() + 0.5);
x2 = (int)(state->getX2() + 0.5);
y2 = (int)(state->getY2() + 0.5);
+ writePSFmt("%%%%PageBoundingBox: %d %d %d %d\n",
+ (int)floor(x1), (int)floor(y1),
+ (int)ceil(x2), (int)ceil(y2));
+ writePS("%%BeginPageSetup\n");
width = x2 - x1;
height = y2 - y1;
- if (width > height && width > paperWidth) {
+ if (width > height && width > imageWidth) {
landscape = gTrue;
writePSFmt("%%%%PageOrientation: %s\n",
state->getCTM()[0] ? "Landscape" : "Portrait");
writePS("pdfStartPage\n");
writePS("90 rotate\n");
tx = -x1;
- ty = -(y1 + paperWidth);
+ ty = -(y1 + imageWidth);
t = width;
width = height;
height = t;
tx = -x1;
ty = -y1;
}
- if (width < paperWidth) {
- tx += (paperWidth - width) / 2;
+ tx += left;
+ ty += bottom;
+ if (width < imageWidth) {
+ tx += (imageWidth - width) / 2;
}
- if (height < paperHeight) {
- ty += (paperHeight - height) / 2;
+ if (height < imageHeight) {
+ ty += (imageHeight - height) / 2;
}
if (tx != 0 || ty != 0) {
writePSFmt("%g %g translate\n", tx, ty);
}
- if (width > paperWidth || height > paperHeight) {
- xScale = (double)paperWidth / (double)width;
- yScale = (double)paperHeight / (double)height;
+ if (width > imageWidth || height > imageHeight) {
+ xScale = (double)imageWidth / (double)width;
+ yScale = (double)imageHeight / (double)height;
if (yScale < xScale) {
xScale = yScale;
} else {
char buffer[8192];
int bytes;
int width, length;
+ int left, bottom, right, top;
int duplex;
}
// Default to "Universal" size - min of A4 and Letter...
+ left = 0;
+ bottom = 0;
+ right = 595;
+ top = 792;
width = 595;
length = 792;
level = psLevel2;
if ((size = ppdPageSize(ppd, NULL)) != NULL)
{
+ left = (int)size->left;
+ bottom = (int)size->bottom;
+ right = (int)size->right;
+ top = (int)size->top;
width = (int)size->width;
length = (int)size->length;
}
globalParams->setPSPaperWidth(width);
globalParams->setPSPaperHeight(length);
+ globalParams->setPSImageableArea(left, bottom, right, top);
globalParams->setPSDuplex(duplex);
globalParams->setPSLevel(level);
globalParams->setPSASCIIHex(level == psLevel1);