send page size with cups LPR command - corretcs bug 15942
Massimo Del Fedele
max at veneto.com
Sun Nov 9 18:41:03 CST 2008
---
dlls/gdi32/printdrv16.c | 3 ++-
dlls/wineps.drv/escape.c | 37 ++++++++++++++++++++++++++++++++++++-
2 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/gdi32/printdrv16.c b/dlls/gdi32/printdrv16.c
index bcf2065..c1fabd3 100644
--- a/dlls/gdi32/printdrv16.c
+++ b/dlls/gdi32/printdrv16.c
@@ -320,7 +320,8 @@ static int CreateSpoolFile(LPCSTR pszOutput)
RegCloseKey(hkey);
}
if (!psCmd[0] && !strncmp("LPR:",pszOutput,4))
- sprintf(psCmd,"|lpr -P'%s'",pszOutput+4);
+// sprintf(psCmd,"|lpr -P'%s'",pszOutput+4);
+ sprintf(psCmd,"|lpr %s",pszOutput+4);
TRACE("Got printerSpoolCommand '%s' for output device '%s'\n",
psCmd, pszOutput);
diff --git a/dlls/wineps.drv/escape.c b/dlls/wineps.drv/escape.c
index b397461..5190ca7 100644
--- a/dlls/wineps.drv/escape.c
+++ b/dlls/wineps.drv/escape.c
@@ -406,7 +406,42 @@ static INT PSDRV_StartDocA( PSDRV_PDEVICE *physDev, const DOCINFOA *doc )
ClosePrinter(hprn);
}
- physDev->job.hJob = OpenJob16(output, doc->lpszDocName, HDC_16(physDev->hdc) );
+ /* dups command - must append -o PageSize=<page size> if needed */
+ char psCmd[1024];
+
+ /* if using LPR: as output device, appends the page size */
+ if(!strncmp(output, "LPR:", 4)) {
+
+ /* appends -P<printer>, must be done here instead of printdrv16.c
+ because of added parameters */
+ sprintf(psCmd, "LPR:-P'%s'", output+4);
+
+ /* gets page size */
+ int sx = MulDiv(physDev->PageSize.cx, 72, physDev->logPixelsX);
+ int sy = MulDiv(physDev->PageSize.cy, 72, physDev->logPixelsY);
+
+ /* scans all supported page sizes to find page name */
+ PAGESIZE *page;
+ LPCSTR paperName = NULL;
+ LIST_FOR_EACH_ENTRY(page, &physDev->pi->ppd->PageSizes, PAGESIZE, entry) {
+ if(page->PaperDimension->x == sx && page->PaperDimension->y == sy) {
+ paperName = page->Name;
+ break;
+ }
+ }
+ if(paperName) {
+ TRACE("PaperName '%s' found for size '%d x %d'\n", paperName, sx, sy);
+ strcat(psCmd, " -o PageSize=");
+ strcat(psCmd, paperName);
+ }
+ else
+ FIXME("PaperName not found for size '%d x %d'\n", sx, sy);
+ }
+ else
+ strcpy(psCmd, output);
+
+
+ physDev->job.hJob = OpenJob16(psCmd, doc->lpszDocName, HDC_16(physDev->hdc) );
if(!physDev->job.hJob) {
WARN("OpenJob failed\n");
return 0;
--
1.5.6.3
--------------080002050307070401080006--
More information about the wine-patches
mailing list