Autor Beitrag
inkoknito
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Mo 05.01.09 17:19 
Hallo Leute,

ich habe eine PDF-Datei, welche mit LH5-komprimiert ist (kann an der Komprimierung nichts ändern und weiß auch nicht womit komprimiert wurde). Diese möchte ich gern dekomprimieren und anschließend unter C:\Temp speichern aber weiß leider nicht genau, wie :evil:

Ich habe nun im Netz eine Unit gefunden, von der ich hoffe, dass sie die Dekomprimierung vornehmen kann.LH5.dcu --> oder im Anhang.

Nun habe ich versucht, den Expand der Unit zu verwenden, aber mein Programm steigt dann an der Stelle des Unit-Aufrufs einfach aus (ohne Fehlermeldung):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure TForm1.Button1Click(Sender: TObject);
var blob_comp:TStream; blob:TStream;
begin
  blob_comp := Form1.Query3.CreateBlobStream(TBlobField(Form1.Query3.FieldByName('DOKUMENT')), bmRead);
  try
    blob_comp.Seek(0, soFromBeginning);
    LH5Unit.LHAExpand(blob_comp, blob);
    with TFileStream.Create('c:\Temp\' + Query3.FieldByName('DOKUMENTNAME').AsString, fmCreate) do
      try

        CopyFrom(blob, blob.Size);

     finally
        Free
      end;
    finally
    blob.Free
  end;
end;


Ich bin in der Dateiverarbeitung und mit Streams noch nich so ganz vertraut (wie man vielleicht sieht). Daher hoffe ich, ihr könnt mir hier weiterhelfen!!

Danke, Jana
Einloggen, um Attachments anzusehen!
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 05.01.09 20:59 
Blob ist nicht Instantiiert. Prüfe zudem die Objekt-Referenzen in den Resourcenschutzblöcken; die stimmen nicht überein.

Zudem sicher, dass die Verwendung der Unit so zu erfolgen hat?

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
inkoknito Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 21



BeitragVerfasst: Di 06.01.09 10:12 
Hallo BenBE,

danke für deine Antwort. Hab den Code etwas angepasst:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button1Click(Sender: TObject);
var blob_comp:TStream; blob:TStream;
begin
  blob := Form1.Query3.CreateBlobStream(TBlobField(Form1.Query3.FieldByName('DOKUMENT')), bmRead);
  blob_comp := Form1.Query3.CreateBlobStream(TBlobField(Form1.Query3.FieldByName('DOKUMENT')), bmRead);
  try
    blob_comp.Seek(0, soFromBeginning);
    LH5Unit.LHAExpand(blob_comp, blob);
    with TFileStream.Create('c:\Temp\' + Query3.FieldByName('DOKUMENTNAME').AsString, fmCreate) do
      try
        CopyFrom(blob, blob.Size);
     finally
        blob.Free
      end;
    finally
    blob_comp.Free
  end;
end;


blob habe ich nun genauso instanziiert wie blob_comp. Ist es möglich, einen "leeren" Blobstream zu instanziieren?

Das löste allerdings nicht mein Problem. Das Programm schließt sich nach wie vor ohne Fehlermeldung. Hast du dir die Lh5Unit mal angesehen? Es gibt dort nur die zwei öffentlichen Prozeduren Compress und Expand. Ich denke also, dass ich die Unit richtig verwende. Lasse mich da aber gern eines Besseren belehren ;-)

Vielleicht noch eine andere Idee? Kann von mir aus auch ein komplett neuer Ansatz sein .. bin über jeden Hinweis dankbar!!

Danke, Jana
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Di 06.01.09 12:22 
Einen leeren Stream bekommst Du mit TMemoryStream.Create; (leerer Stream im Speicher).

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.