From b78558faa1f640bcfe067ccfdd7d64dfbb3ea048 Mon Sep 17 00:00:00 2001 From: "rods%netscape.com" Date: Thu, 16 May 2002 14:20:04 +0000 Subject: [PATCH] Allows for printed more than one copy for the postscript print module Bug 139566 r=roland sr=attinasi adt=petterman a=chofmann,dbaron,valeski git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_0_BRANCH@121626 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/src/ps/nsIDeviceContextSpecPS.h | 9 +++++++++ mozilla/gfx/src/ps/nsPostScriptObj.cpp | 8 +++++++- mozilla/gfx/src/ps/nsPostScriptObj.h | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mozilla/gfx/src/ps/nsIDeviceContextSpecPS.h b/mozilla/gfx/src/ps/nsIDeviceContextSpecPS.h index 2812a0bbe5e..bf4c81a4640 100644 --- a/mozilla/gfx/src/ps/nsIDeviceContextSpecPS.h +++ b/mozilla/gfx/src/ps/nsIDeviceContextSpecPS.h @@ -163,6 +163,15 @@ public: * Returns W/H in Twips from Paper Size H/W */ NS_IMETHOD GetPageSizeInTwips(PRInt32 *aWidth, PRInt32 *aHeight) = 0; + + /* + * Return number of copies to print + * @update + * @param aCopies + * @return + */ + NS_IMETHOD GetCopies ( int &aCopies ) = 0; + }; #endif /* !nsIDeviceContextSpecPS_h___ */ diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.cpp b/mozilla/gfx/src/ps/nsPostScriptObj.cpp index 2a87520655e..9d22e3d5f0e 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.cpp +++ b/mozilla/gfx/src/ps/nsPostScriptObj.cpp @@ -316,6 +316,7 @@ nsPostScriptObj::Init( nsIDeviceContextSpecPS *aSpec ) mPrintSetup->deep_color = PR_TRUE; // 24 bit color output mPrintSetup->reverse = 0; // Output order, 0 is acsending if ( aSpec != nsnull ) { + aSpec->GetCopies(mPrintSetup->num_copies); aSpec->GetGrayscale( isGray ); if ( isGray == PR_TRUE ) { mPrintSetup->color = PR_FALSE; @@ -2004,7 +2005,12 @@ FILE *f; f = mPrintContext->prSetup->out; fprintf(f, "%%%%Page: %d %d\n", mPageNumber, mPageNumber); - fprintf(f, "%%%%BeginPageSetup\n/pagelevel save def\n"); + fprintf(f, "%%%%BeginPageSetup\n"); + if(mPrintSetup->num_copies != 1) { + fprintf(f, "1 dict dup /NumCopies %d put setpagedevice\n", + mPrintSetup->num_copies); + } + fprintf(f,"/pagelevel save def\n"); if (mPrintContext->prSetup->landscape){ fprintf(f, "%d 0 translate 90 rotate\n",PAGE_TO_POINT_I(mPrintContext->prSetup->height)); } diff --git a/mozilla/gfx/src/ps/nsPostScriptObj.h b/mozilla/gfx/src/ps/nsPostScriptObj.h index b4c7eb474ad..76147bede4e 100644 --- a/mozilla/gfx/src/ps/nsPostScriptObj.h +++ b/mozilla/gfx/src/ps/nsPostScriptObj.h @@ -221,6 +221,7 @@ struct PrintSetup_ { void* carg; /* Data saved for completion routine */ int status; /* Status of URL on completion */ const char *print_cmd; /* print command */ + int num_copies; /* Number of copies of job to print */ /* "other" font is for encodings other than iso-8859-1 */ char *otherFontName[N_FONTS];