Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Impresión (https://www.clubdelphi.com/foros/forumdisplay.php?f=4)
-   -   Problema al imprimir la Ñ . (https://www.clubdelphi.com/foros/showthread.php?t=25857)

AGAG4 05-10-2005 23:16:26

Problema al imprimir la Ñ .
 
Tengo la siguiente función en delphi donde mando a imprimir un archivo de texto a una impresora matricial, no imprime la Ñ ó ñ, me imprime un caracter raro Ð, abro el mismo archivo de texto en el bloc de notas y si aparece la Ñ y si imprimo en el ms-dos(copy File.txt \\PC\Print) el archivo de texto no me imprime la Ñ me imprime el mismo signo raro Ð:
Código Delphi [-]
function SpoolFile(const FileName, PrinterName: string): Integer;
var
Buffer: record
JobInfo: record // ADDJOB_INFO_1
Path: PChar;
JobID: DWORD;
end;
PathBuffer: array[0..255] of Char;
end;
SizeNeeded: DWORD;
Handle: THandle;
PrtName: string;
ok: Boolean;
begin
// Flush job to printer
PrtName := PrinterName;
if PrtName = '' then
PrtName := Printer.Printers[Printer.PrinterIndex]; // Default printer name
ok := False;
if OpenPrinter(PChar(PrtName), Handle, nil) then
if AddJob(Handle, 1, @Buffer, SizeOf(Buffer), SizeNeeded) then
if CopyFile(PChar(FileName), Buffer.JobInfo.Path, True) then
if ScheduleJob(Handle, Buffer.JobInfo.JobID) then
ok := True;
if not ok then
Result := GetLastError
else
Result := 0;
end;
Esta función lo que me sirve es tomar el archivo y mandar a cierta impresora dependiendo del nombre de la misma.

Agradezco cualquier sugerencia

pcicom 06-10-2005 01:06:25

Re: Problema al imprimir Ñ
 
Debes de asegurarte de que tu impresora tenga configurado el set de caracteres correcto que corresponda,, generalmente las impreroras matriciales tienen un set de configuracion donde habilitas el tipo de set de caracteres a utilziar, la mayoria biene para un set USA, el cual incluye por default USA..

AGAG4 06-10-2005 02:13:50

oki
 
Gracias por la Ayuda, pero lo corregí de la siguiente forma, antes de imprimir cambie el caracter Ñ por el que le corresponde en ASCII:
Código Delphi [-]
function OEMToString(Str:String):String;
var x:integer;
begin
  result:='';
  for x:=1 to length(Str) do
    if Str[x]='Ñ' then
      result:=result+Chr(165)
    else  
    if Str[x]='ñ' then
      result:=result+Chr(164)
    else
      result:=result+Str[x];
end;

Que tenga buen día.


La franja horaria es GMT +2. Ahora son las 15:57:53.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi