Ir al contenido


Foto

[FastReport] Reporte Con múltiples imágenes crece mucho en tamaño


  • Por favor identifícate para responder
5 respuestas en este tema

#1 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 06 agosto 2018 - 11:50

Tengo un reporte en fast report que relleno imagenes en tiempo de ejecución, además de tardarse en cargarse en la impresión muestra que un documento con 4 imágenes llega a pesar 2.8GB en tamaño,¿WTF?, cada imagen no pesa más de 1mb, ésto es lo que tengo:


delphi
  1. procedure TFDatosVME.CreateFotosBox(Sender: TfrxReportComponent);
  2. var Cols: Integer;
  3. aTop,aLeft: Extended;
  4. aPicBox: TfrxPictureView;
  5. aRect: TfrxShapeView;
  6. aParent: TfrxChild;
  7. aPath: String;
  8. begin
  9. Cols := 0;
  10.  
  11. aPath := Rutinas.getSetting('VME_PATH');
  12.  
  13. aParent := frxFotos.FindObject('child3') as TfrxChild;
  14.  
  15. aTop := 1.5118;
  16. aLeft := 10.96;
  17.  
  18. if QPrintFotos.Active then begin
  19. QPrintFotos.First;
  20. while not QPrintFotos.Eof do begin
  21.  
  22. if Cols = 2 then begin
  23. aLeft := 10.96;
  24. Cols := 0;
  25. aTop := aTop + 238.110;
  26. end;
  27.  
  28. Inc(Cols);
  29.  
  30. aPicBox := TfrxPictureView.Create(nil);
  31. aPicBox.Parent := aParent;
  32. aPicBox.Height := 238.110;
  33. aPicBox.Width := 355.27559055;
  34. aPicBox.Top := aTop;
  35. aPicBox.Left := aLeft;
  36. aPicBox.Stretched := True;
  37. aPicBox.Center := True;
  38. aPicBox.KeepAspectRatio := True;
  39. aPicBox.HightQuality := False;
  40. aPicBox.Picture.LoadFromFile(aPath + QPrintFotos.FieldByName('veh_foto').AsString);
  41.  
  42. aLeft := aPicBox.Width + 18.90;
  43.  
  44. QPrintFotos.Next;
  45.  
  46. end;
  47. end;
  48. end;

¿A qué se debe tanto peso?


 


  • 0

#2 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 06 agosto 2018 - 02:21

Usando la Propiedad FileLink del Componente TfxrPictureView de FastReport la cosa se reduce a 591 Mb. :|


  • 0

#3 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 06 agosto 2018 - 02:49

Sorpresivamente poniendo los TfrxPictureView en diseño y cargando las imágenes de manera manual todo es fluído y pesa mucho menos:


delphi
  1. procedure TFDatosVME.CreateFotosBox(Sender: TfrxReportComponent);
  2. var aPath: String;
  3. aPicDer,aPicIzq,aPicChasis: TfrxPictureView;
  4. aPicFrente, aPicAtras, aPicMotor: TfrxPictureView;
  5. aArea: String;
  6. begin
  7.  
  8. aPath := Rutinas.getSetting('VME_PATH');
  9.  
  10. aPicDer := frxFotos.FindObject('Picture2') as TfrxPictureView;
  11. aPicIzq := frxFotos.FindObject('Picture3') as TfrxPictureView;
  12. aPicFrente := frxFotos.FindObject('Picture4') as TfrxPictureView;
  13. aPicAtras := frxFotos.FindObject('Picture5') as TfrxPictureView;
  14. aPicChasis := frxFotos.FindObject('Picture6') as TfrxPictureView;
  15. aPicMotor := frxFotos.FindObject('Picture7') as TfrxPictureView;
  16.  
  17. if QPrintFotos.Active then begin
  18. QPrintFotos.First;
  19. while not QPrintFotos.Eof do begin
  20. aArea := QPrintFotos.FieldByName('veh_area').AsString;
  21.  
  22. if aArea = 'Lado Derecho' then
  23. aPicDer.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  24. else if aArea = 'Lado Izquierdo' then
  25. aPicIzq.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  26. else if aArea = 'Motor' then
  27. aPicMotor.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  28. else if aArea = 'Chasis' then
  29. aPicChasis.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  30. else if aArea = 'Parte Frontal' then
  31. aPicFrente.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  32. else if aArea = 'Parte Trasera' then
  33. aPicAtras.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString;
  34.  
  35.  
  36. QPrintFotos.Next;
  37.  
  38. end;
  39. end;
  40. end;

En conclusión, no se les ocurra crear objetos de imágenes en tiempo de ejecución en FastReport.

 

Saudos.


  • 0

#4 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14.446 mensajes
  • LocationMéxico

Escrito 06 agosto 2018 - 03:49

Sorpresivamente poniendo los TfrxPictureView en diseño y cargando las imágenes de manera manual todo es fluído y pesa mucho menos:

En conclusión, no se les ocurra crear objetos de imágenes en tiempo de ejecución en FastReport.
 
Saudos.


Vientos Bro, anotado :)

Saludos (y)


  • 0

#5 lbuelvas

lbuelvas

    Member

  • Miembros
  • PipPip
  • 20 mensajes
  • LocationColombia

Escrito 07 agosto 2018 - 07:04

Sorpresivamente poniendo los TfrxPictureView en diseño y cargando las imágenes de manera manual todo es fluído y pesa mucho menos:


delphi
  1. procedure TFDatosVME.CreateFotosBox(Sender: TfrxReportComponent);
  2. var aPath: String;
  3. aPicDer,aPicIzq,aPicChasis: TfrxPictureView;
  4. aPicFrente, aPicAtras, aPicMotor: TfrxPictureView;
  5. aArea: String;
  6. begin
  7.  
  8. aPath := Rutinas.getSetting('VME_PATH');
  9.  
  10. aPicDer := frxFotos.FindObject('Picture2') as TfrxPictureView;
  11. aPicIzq := frxFotos.FindObject('Picture3') as TfrxPictureView;
  12. aPicFrente := frxFotos.FindObject('Picture4') as TfrxPictureView;
  13. aPicAtras := frxFotos.FindObject('Picture5') as TfrxPictureView;
  14. aPicChasis := frxFotos.FindObject('Picture6') as TfrxPictureView;
  15. aPicMotor := frxFotos.FindObject('Picture7') as TfrxPictureView;
  16.  
  17. if QPrintFotos.Active then begin
  18. QPrintFotos.First;
  19. while not QPrintFotos.Eof do begin
  20. aArea := QPrintFotos.FieldByName('veh_area').AsString;
  21.  
  22. if aArea = 'Lado Derecho' then
  23. aPicDer.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  24. else if aArea = 'Lado Izquierdo' then
  25. aPicIzq.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  26. else if aArea = 'Motor' then
  27. aPicMotor.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  28. else if aArea = 'Chasis' then
  29. aPicChasis.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  30. else if aArea = 'Parte Frontal' then
  31. aPicFrente.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString
  32. else if aArea = 'Parte Trasera' then
  33. aPicAtras.FileLink := aPath + QPrintFotos.FieldByName('veh_foto').AsString;
  34.  
  35.  
  36. QPrintFotos.Next;
  37.  
  38. end;
  39. end;
  40. end;

En conclusión, no se les ocurra crear objetos de imágenes en tiempo de ejecución en FastReport.

 

Saudos.

 

Lo que he observado con FastReport es que si necesitas cargar una imagen que se va a utilizar en todas las hojas del informe es mejor hacerlo montándolas justo antes de de ejecutar Reporte.ShowReport.  Si uno carga las imágenes en el evento BeforePrint, FastReport piensa que cada imagen es distinta y utiliza tanto espacio en memoria como necesite cada imagen, pero si las cargamos ante de lanzar el reporte, FastRreport utilizara esas imágenes en cada una de las hojas del informe utilizando mínimo espacio en memoria.


  • 0

#6 enecumene

enecumene

    Webmaster

  • Administrador
  • 7.419 mensajes
  • LocationRepública Dominicana

Escrito 08 agosto 2018 - 12:37

Gracias lbuelvas, no lo había pensado de ésa manera, yo siempre acostumbro hacer cualquier cosa con fastReport a través del evento OnBeforePrint, haré la prueba en cuanto tenga tiempo.

 

Saludos.


  • 0




IP.Board spam blocked by CleanTalk.