Printing with Lazreport to matrix printer (epson lx 810) lazarus / 5-Lazarus Extra Components ---------------------------------------------------------------------- clauslack · 2009-12-15 19:06 Printing with Lazreport to matrix printer (epson lx 810) Windows, fine Linux,  bad Linux kernel 2.6, kde 3.5, cups 1.3.10, driver epson 9-pin Series (max resolution) Any Idea? Thanks ---------------------------------------------------------------------- jesusr · 2009-12-15 21:14 please submit a bug report with a sample project. ---------------------------------------------------------------------- jesusr · 2009-12-15 21:26 forgot to comment, a solution that might worth to try, for taking advantage of dot matrix printers and lazreport, first export the report using TfrTextExporFilter and then sent the generated file using printer in RawMode. see the samples on lazreport/samples/editor and printers/samples/rawmode On writing this it occured to me that it might be possible to extend text exporter by including control characters so dot matrix printer can print texts in bold and italic, will try to make it later. ---------------------------------------------------------------------- clauslack · 2009-12-16 00:03 I try Code: [Select]    frReport1.LoadFromFile('listado_caja_bonos.lrf');     frReport1.ExportTo(TfrTextExportFilter ,'caja.txt'); but only create an empty 'caja.txt'. What is wrong? Regards ---------------------------------------------------------------------- jesusr · 2009-12-16 20:02 Try preparing the report: Code: [Select]frReport1.LoadFromFile('listado_caja_bonos.lrf'); if frReport1.PrepareReport then   frReport1.ExportTo(TfrTextExportFilter ,'caja.txt'); ---------------------------------------------------------------------- clauslack · 2009-12-16 21:39 Seems to work!!! The file caja.txt is saved with a blank line each 2 records (I avoid that lines) 1) How avoid the dialog (Altura promedio de la fuente) ? Later I will post the code. Thanks ---------------------------------------------------------------------- jesusr · 2009-12-17 20:20 The conversion from graphical report to text export is influenced by UsedFont TfrTextExportFilter property, it's value can be changed in TfrReport event OnExportFilterSetup, all is documented in the export filters documentation: http://wiki.lazarus.freepascal.org/LazReport_Do cumentation#Export_Filters Note that you need LazReport 0.9.6 (to be able to avoid dialog asking for UsedFont value) and if possible Lazarus revision 23170 for better results on text export. ---------------------------------------------------------------------- clauslack · 2009-12-17 21:28 Muchisimas Gracias Jesus I test under Linux k2.6.31, matrix printer, Lazarus svn 23170 and work fine. I adapt two things - Use condensed mode. - Avoid empty lines. Here is the code. The procedures Code: [Select]procedure ImprimirCadenaRaw(S:String); const Kenter=CHR(13)+CHR(10); var  Written: Integer; begin   Written:=0;   S:=Utf8toAnsi(S+Kenter);   S:=AnsiToOemOp(s);//porque las matriciales esperan cadenas OEM   Printer.Write(S[1], Length(S), Written); end; procedure ImprimirCodigoEsc(S:String); var Written: Integer; begin   Written:=0;   Printer.Write(S[1], Length(S), Written); end; Export the report to file, later print the file in raw mode to the matrix printer. Code: [Select]frReport1.LoadFromFile('listado_caja_bonos.lrf'); if not PrintDialog1.Execute then exit; archivo:=ExtractFilePath(Application.ExeName)+'sysimpre.tmp'; if frReport1.PrepareReport then frReport1.ExportTo(TfrTextExportFilter,archivo); ArchivoTexto:=TStringList.Create; ArchivoTexto.LoadFromFile(archivo); Printer.RawMode := True; Printer.BeginDoc; ImprimirCodigoEsc(chr(27)+CHR(64)); ImprimirCodigoEsc(CHR(27)+CHR(67)+CHR(64)); //page of 64 lines ImprimirCodigoEsc(CHR(27)+chr(15)); //condensed mode CantLineas:=0; for i:=0 to ArchivoTexto.Count-1 do begin   Linea:=Trim(ArchivoTexto[i]);   if Linea='' then continue;   ImprimirCadenaRaw(ArchivoTexto[i]);   inc(CantLineas);   if CantLineas>64 then begin     ImprimirCadenaRaw(CHR(12)+CHR(13));//EJECT PAGE     CantLineas:=0   end; end; ImprimirCodigoEsc(CHR(12)+CHR(13));//EJECT PAGE ImprimirCodigoEsc(chr(18)); //cancel condensed mode Printer.EndDoc; Printer.RawMode := false; ArchivoTexto.Free; Regards ---------------------------------------------------------------------- yosoyelkin · 2011-12-26 15:52 can anyone help me? I want to print in a star printer, but LazReport doesn't works in Windows CE..