PROBLEMA.ACTUAL
* Quiero que la impresion en una imagen sea exactamente como cuando envio a la impresora.
Var preview : TImage. procedure InitPrinter; var XD,YD:Integer; x,y:string; begin if lPrinter then begin // pixels/inch horizontales XD:=GetDeviceCaps(Printer.Handle,LogPixelSX); // pixels/inch verticales YD:=GetDeviceCaps(Printer.Handle,LogPixelSY); nFx := XD/25.4; nFy := YD/25.4; nFx := nFx * 10; nFy := nFy * 10; nIncY:=0; printer.Canvas.brush.Style:=bsClear; end ELSE begin //Factores de Calculo Pixel/MM nFx := GetDeviceCaps(printer.Handle,LogPixelSX)/25.4; nFy := GetDeviceCaps(printer.Handle,LogPixelSY)/25.4; // //////////////////////////////////// // CON ESTOS VALORES LA IMPRESION ES MUY SIMILAR A IMPRESORA //////////////////////////////////// // nFx := 37.795275591; nFy := 37.795275591; x := floattostr(int(nFy*100)); y := floattostr(int(nFX*100)); nIncY:=0; preview.Height := strtoint(y); preview.Width := strtoint(x); preview.Canvas.brush.Style:=bsClear; preview.Picture := nil; end; end; procedure TipoLetra(cFont:String; nSize:Integer); begin if lPrinter then begin printer.Canvas.font.Name := aLLTRIM(cFont); if nSize>0 then printer.canvas.Font.Size := nSize; end ELSE begin preview.Canvas.font.Name := AllTrim(cFont); if nSize>0 then preview.canvas.Font.Size := nSize; end; end; procedure Escribe(xPos:Extended;cValor,cMask:String); Var x,y:integer; begin xPos := int(xPos * nFx); x := strtoint(floattostr(xPos)); if lPrinter then begin y:=printer.canvas.PenPos.y; cValor := Maskara(cValor,cMask); printer.Canvas.Brush.Style := bsClear; printer.Canvas.TextOut(x,y,cValor); end ELSE begin y:=preview.canvas.PenPos.y; cValor := Maskara(cValor,cMask); preview.Canvas.Brush.Style := bsClear; preview.Canvas.TextOut(x,y,cValor); end; end; procedure EscribeXY(x1,y1:Extended;cValor,cMask:String); Var x,y:integer; begin x1 := int(x1 * nFx); y1 := int(y1 * nFy); x := strtoint(floattostr(x1)); y := strtoint(floattostr(y1)) + nIncY; cValor := Maskara(cValor,cMask); if lPrinter then begin printer.Canvas.Brush.Style := bsClear; printer.Canvas.TextOut(x,y,cValor); end else begin preview.Canvas.Brush.Style := bsClear; preview.Canvas.TextOut(x,y,cValor); end; Brinca(1); end;
Edited by pcicom, 13 April 2017 - 09:23 AM.