[Wine] Delphi applications printing bug

psalvan paolo.salvan at gmail.com
Mon Mar 19 00:51:50 CDT 2007


Hi,

I'm using Wine 0.9.27 and Ubuntu 6.06.

I've problems when printing from Delphi Apps that use QReport (the
default reporting engine for most Delphi versions), and after some
hacking I've perhaps isolated the trouble:

it seems that Delphi printing over a Canvas works only if I show the
system PrintDialog or the PrinterSetupDialog befor printing, and I
press OK in this dialog: printing directly to the default printer
doesn't work under Wine, but works regularly under Windows ("doesn't
work" meens that nothing is encoded in the printing spool... and the
only error that is shown is "fixme:psdrv:PSDRV_EndPage Already ended a
page?")

Ie, this code works both under Windows and Wine:

procedure TForm1.Button2Click(Sender: TObject);
var SetupDialog: TPrinterSetupDialog;
begin
    SetupDialog:= TPrinterSetupDialog.Create(Application);
    SetupDialog.Execute;

    with Printer do
    begin
        BeginDoc;
        Canvas.TextOut(100, 100, 'Test');
        EndDoc;
    end;
end;

...while this code works only under Windows:

procedure TForm1.Button1Click(Sender: TObject);
begin
    with Printer do
    begin
        BeginDoc;
        Canvas.TextOut(100, 100, 'Test');
        EndDoc;
    end;
end;

Enabling deeper log on "psdrv", and comparing the log files of the two
version ('-' is the non-working one, "+" is the working one...), I've
found something interesting:

[...]
 trace:psdrv:PSDRV_MergeDevmodes Changing page to A4 2099 x 2970
 trace:psdrv:PSDRV_FindPrinterInfo No 'Paper Size' for printer
'PostScript-Printer-1'
 trace:psdrv:PSDRV_FindPrinterInfo No 'FontSubTable' for printer
'PostScript-Printer-1'
-trace:psdrv:PSDRV_CreateDC (L"WINEPS.DRV" L"PostScript-Printer-1" L""
0x179bd8)
+trace:psdrv:PSDRV_CreateDC (L"WINEPS.DRV" L"PostScript-Printer-1"
L"LPT1:" (nil))
+trace:psdrv:PSDRV_UpdateDevCaps ImageableArea = 0,0 - 2479,3508:
PageSize = 2479x3508
+trace:psdrv:PSDRV_UpdateDevCaps devcaps: horzSize = 209mm, vertSize =
297mm, horzRes = 2479, vertRes = 3508
+trace:psdrv:PSDRV_SelectFont FaceName = L"" Height = 100 Italic = 0
Weight = 400
+trace:psdrv:PSDRV_SelectPen hpen = 0x60 colour = 00000000
[...]
+trace:psdrv:PSDRV_MergeDevmodes Changing page to A4 2099 x 2970
+trace:psdrv:PSDRV_FindPrinterInfo No 'Paper Size' for printer
'PostScript-Printer-1'
+trace:psdrv:PSDRV_FindPrinterInfo No 'FontSubTable' for printer
'PostScript-Printer-1'
+trace:psdrv:PSDRV_CreateDC (L"WINEPS.DRV" L"PostScript-Printer-1"
L"LPR:PostScript-Printer-1" 0x173180)
 trace:psdrv:PSDRV_MergeDevmodes Changing orientation to 1 (Portrait)
 trace:psdrv:PSDRV_MergeDevmodes Changing page to A4 2099 x 2970
 trace:psdrv:PSDRV_MergeDevmodes Changing Scale to 100
 trace:psdrv:PSDRV_MergeDevmodes Changing Copies to 1
 trace:psdrv:PSDRV_MergeDevmodes Trying to change to unsupported bin 7
 trace:psdrv:PSDRV_UpdateDevCaps ImageableArea = 0,0 - 2479,3508:
PageSize = 2479x3508
 trace:psdrv:PSDRV_UpdateDevCaps devcaps: horzSize = 209mm, vertSize =
297mm, horzRes = 2479, vertRes = 3508
 trace:psdrv:PSDRV_SelectFont FaceName = L"" Height = 100 Italic = 0
Weight = 400
 trace:psdrv:PSDRV_SelectPen hpen = 0x60 colour = 00000000
 trace:psdrv:PSDRV_SelectBrush hbrush = 0x44
 trace:psdrv:PSDRV_SelectFont FaceName = L"" Height = 100 Italic = 0
Weight = 400
 trace:psdrv:PSDRV_WriteHeader '""'
-warn:psdrv:PSDRV_WriteHeader WriteSpool error
 trace:psdrv:PSDRV_SelectFont FaceName = L"MS Sans Serif" Height = -33
Italic = 0 Weight = 400
 trace:psdrv:PSDRV_SelectBrush hbrush = 0x5c4
 trace:psdrv:PSDRV_ExtTextOut (x=0, y=0, flags=0x00000002, str=(null),
count=0, lpDx=(nil))
-warn:psdrv:PSDRV_WriteNewPage WriteSpool error
-warn:psdrv:PSDRV_WriteNewPage WriteSpool error
-warn:psdrv:PSDRV_WriteNewPage WriteSpool error
-warn:psdrv:PSDRV_WriteNewPage WriteSpool error
[...]
..and here start a long list of errors;

What seems to cause trobles is the different way of calling
PSDRV_CreateDC:

-trace:psdrv:PSDRV_CreateDC (L"WINEPS.DRV" L"PostScript-Printer-1" L""
0x179bd8)
+trace:psdrv:PSDRV_CreateDC (L"WINEPS.DRV" L"PostScript-Printer-1"
L"LPT1:" (nil))


I can't find any bug report reguarding this problem; should I post one?
I can supply a minimal executable that reproduce the problem.

Thank for the attention and bye!

Paolo Salvan



More information about the wine-users mailing list