Hola
mtirado, hace tiempo hice una aplicación para imprimir imágenes que recibía vía FTP (en horizontal o vertical) y las copiaba directamente en el canvas de la impresora, no se si te servirá pero te paso el código.
Código Delphi
[-]
procedure TWin_Main.mnuImprimir_OnClick(Sender: TObject);
var
tmpTImage : TImage;
tmpGifImagen : TGIFImage;
tmpRotateImage : TRotateImage;
tmpBitMapRotado: TBitMap;
newArea : TRect;
FILE_PRINTER : string;
estaHorizontal : boolean;
estaVertical : boolean;
begin
FILE_PRINTER := ExtractFilePath( FILE_COPY ) + 'PRINTER';
estaHorizontal := false;
estaVertical := false;
tmpGifImagen := TGIFImage.Create;
try
tmpGifImagen.LoadFromFile( FILE_COPY+'.GIF' );
tmpGifImagen.Frames[0].Bitmap.SaveToFile( FILE_PRINTER+'.BMP' );
if( tmpGifImagen.Frames[0].Bitmap.Width>tmpGifImagen.Frames[0].Bitmap.Height )
then estaHorizontal := true
else estaVertical := true;
finally
tmpGifImagen.Free;
end;
tmpTImage := TImage.Create( nil );
with tmpTImage do begin
Visible := false;
Parent := Win_Main;
AutoSize := true;
Center := false;
Stretch := false;
end;
try
tmpTImage.Picture.Bitmap.LoadFromFile( FILE_PRINTER+'.BMP' );
tmpTImage.Refresh;
if( tmpTImage.Width>tmpTImage.Height ) then begin
tmpRotateImage := TRotateImage.Create(nil);
try
with tmpRotateImage do begin
UniqueSize := false;
Picture.LoadFromFile( FILE_PRINTER+'.BMP' );
Angle := -90;
RotatedBitmap.SaveToFile(FILE_PRINTER+'.BMP');
end;
finally
tmpRotateImage.Free;
end;
end;
finally
tmpTImage.Free;
end;
tmpBitMapRotado:= TBitMap.Create;
try
tmpBitMapRotado.LoadFromFile( FILE_PRINTER+'.BMP' );
with Printer do begin
Title := 'MAPA '+ExtractFileName( FILE_COPY )+' correspondiente al '+FechaToCadena( Now, true );
if( tmpBitMapRotado.Width>tmpBitMapRotado.Height ) then begin
Orientation := poLandscape;
end else begin
Orientation := poPortrait;
end;
with newArea do begin
Left := 100;
Top := 100;
Right := PageWidth - 200;
Bottom := PageHeight - 200;
end;
BeginDoc;
Canvas.StretchDraw( newArea, tmpBitMapRotado );
Canvas.TextOut( 50, 10, Title );
EndDoc;
end;
finally
tmpBitMapRotado.Free;
end;
if FileExists( FILE_PRINTER+'.BMP' ) then DeleteFile( FILE_PRINTER+'.BMP' );
mnuImprimir.Enabled := false;
end;
La imágen podía tener cualquier tamaño. La parte que te interesa está al final, donde ajusto la imagen al tamaño del paper (DIN-A4)
Saludos
salvica