AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Probleme mit dynapdf

Ein Thema von philubb · begonnen am 25. Okt 2012
Antwort Antwort
philubb

Registriert seit: 27. Jun 2012
16 Beiträge
 
Delphi XE Enterprise
 
#1

Probleme mit dynapdf

  Alt 25. Okt 2012, 11:04
Hallo

ich verwende im Geschäft dynapdf um Reports zu erstellen.

Nun möchte ich einen Barcode in eine Celle einer erstellen Tabelle, als Bild (Bitmap) einfügen.
Das funktioniert auch so weit.

Delphi-Quellcode:
 ....
    
 //Pfad wo Bitmap später stehen soll
  BCPfad := 'C:\EDM\VIA\Barcode'+cdsDruck.FieldByName('AUFTRAG_NR').AsString + '.bmp';
 //Barcode erstellen
  CreateBarcode(BCPfad,cdsDruck.FieldByName('AUFTRAG_NR').AsString);
  if BCPfad <> 'then
  begin
    //Schneidet die Zahlen, die unter dem Barcode stehen ab
    BitmapAnpassen(BCPfad);
    //Bitmap in TImage Komponente laden
    imgBarcode.Picture.LoadFromFile(BCPfad);
    //Bild in die entsprechende Zelle setzen
    Auftrag.Cells[4,zeile+32+i].Image := imgBarcode;
  end;

  procedure TFormVIA.CreateBarcode(var BCPfad:String; Code:String);
var
  bmp:TBitmap;
begin
  try
    Barcode1d1.Code:=Code;
    bmp := TBitmap.create();
    bmp.height := 100;
    bmp.width := 250;
    barcode1d1.paintBarcode(bmp.Canvas);
    bmp.SaveToFile(BCPfad);
    bmp.Free;
  except
    on e:Exception do
      //showmessage(e.message);
      BCPfad := '';
  end;
end;

procedure TFormVIA.BitmapAnpassen(Pfad:String);
var
  SourceBitmap:TBitmap;
  TargetBitmap:TBitmap;
  Cut : TRect;
begin
  SourceBitmap := TBitmap.Create;
  TargetBitmap := TBitmap.Create;
  try
    SourceBitmap.LoadFromFile(Pfad);
    Cut.Left := 10;
    Cut.Top := 20;
    Cut.Right := 130;
    Cut.Bottom := 70;

    TargetBitmap.Width := Cut.Right - Cut.Left;
    TargetBitmap.Height := Cut.Bottom - Cut.Top;

    BitBlt(TargetBitmap.Canvas.Handle,0,0,Cut.Right,Cut.Bottom,SourceBitmap.Canvas.Handle,Cut.Left,Cut.Top,SRCCOPY);
    SourceBitmap.Canvas.Refresh;

    if FileExists(Pfad) then
      DeleteFile(Pfad);

    TargetBitmap.SaveToFile(Pfad);
  finally
    SourceBitmap.Free;
    TargetBitmap.Free;
  end;
end;
Das klappt alles.
Aber die Celle passt sich nicht, an die größe des Bildes an. Woran kann das liegen?

Hab auch schon nach Lösungen im Internet gesucht, aber finde kaum verwendbare Informationen. Vielleicht hat mir ja auch jemand ein Tutorial.

Gruß
Miniaturansicht angehängter Grafiken
unbenannt.png  
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:02 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz