3737interface
3838
3939uses
40- SkiSys.GS_API, SkiSys.GS_ParameterTypes, SkiSys.GS_Errors
40+ SkiSys.GS_API, SkiSys.GS_ParameterTypes, SkiSys.GS_ParameterConst,
41+ SkiSys.GS_Errors
4142{ $IFDEF DELPHI}
4243 , System.Classes, System.SysUtils
4344{ $ENDIF}
@@ -129,8 +130,8 @@ TGS_PdfConverter = class(TGS_Converter)
129130 // destructor
130131 destructor Destroy; override;
131132 // / <summary>
132- // / Print the file on the printer, when the printer doesn't exists the
133- // / default printer will be used by Ghostscript .
133+ // / Print the file on the printer. When the printer doesn't exists, a printer
134+ // / will be shown under Windows .
134135 // / </summary>
135136 // / <param name="InFile">
136137 // / The input file(s).
@@ -139,8 +140,8 @@ TGS_PdfConverter = class(TGS_Converter)
139140 function Print (InFile: string; PrinterName: string;
140141 Threaded: Boolean = False): Boolean; overload;
141142 // / <summary>
142- // / Concat the given files and print them as 1 job on the printer, when the
143- // / printer doesn't exists the default printer will be used by Ghostscript .
143+ // / Concat the given files and print them as 1 job on the printer. When the
144+ // / printer doesn't exists a printer dialog will appear under Windows .
144145 // / </summary>
145146 function Print (const InFiles: array of string; PrinterName: string;
146147 Threaded: Boolean = False): Boolean; overload;
@@ -265,7 +266,7 @@ function TGS_Converter.InitWithArgs(AStrings: TStrings; Threaded: Boolean): Bool
265266procedure TGS_Converter.SetOutputFile (AList: TStringList; AValue: string);
266267begin
267268 if (AValue <> ' ' ) and (not AValue.StartsWith(' %' )) then
268- AList.Add(' -sOutputFile=' + TGSParams.GetFullLinuxFilePath(AValue, True));
269+ AList.Add(' -sOutputFile=' + TGSParams.GetFullLinuxFilePath(AValue, True))
269270end ;
270271
271272procedure TGS_Converter.SetParams (AList: TStringList);
@@ -363,10 +364,16 @@ function TGS_PdfConverter.Print(const InFiles: array of string;
363364 PrinterName: string; Threaded: Boolean): Boolean;
364365begin
365366 { $IFDEF MSWINDOWS}
366- if (Params.Device = ' pdfwrite' ) then
367- Params.Device := ' mswinpr2' ;
367+ // set the printer device for windows
368+ if (Params.Device <> DEVICES_PRINTERS[MSWindowsPrinter]) then
369+ Params.Device := DEVICES_PRINTERS[MSWindowsPrinter];
370+ if (PrinterName.StartsWith(' %printer%' )) then
371+ Params.OutputFile := ' %printer%' + Printername
372+ else
373+ Params.OutputFile := Printername;
368374 { $ENDIF}
369- Result := Convert(InFiles, PrinterName, Threaded);
375+ // TODO: Add Linux Printers
376+ Result := Convert(InFiles, ' ' , Threaded);
370377end ;
371378
372379procedure TGS_PdfConverter.SetParams (AList: TStringList);
0 commit comments