Subject | Re: [IBO] Re: How to store/retrieve PDFs using IBObjects |
---|---|
Author | Andeas Hesse |
Post date | 2019-10-21T17:20:38Z |
For compressing I use JVCL with 7-zip
dll.
Am 21.10.2019 um 17:52 schrieb
firebird.users@... [IBObjects]:
I'm not familiar with the Abbrevia components but assuming they give you a TStream for your compressed PDF, to save it to the database you can try passing it into a function something like this:
procedure LoadFromStream(const S: TIB_Statement; const ParamName: string; const InputStream: TStream);
var
wStream: TStream;
blob: TIB_ColumnBlob;
begin
blob := S.ParamByName(ParamName) as TIB_ColumnBlob;
wStream := S.CreateBlobStream(blob, bsmWrite);
try
wStream.CopyFrom(InputStream, 0);
finally
wStream.Free;
end;
end;
Example call:
ib_dsql.SQL.Text := 'insert into PDF_TABLE (ID, PDF_FILE) values (1, :PDF_FILE)';
LoadFromStream(ib_dsql, 'PDF_FILE', StreamFromAbbrevia);
ib_dsql.Execute;
I'm sure you can streamline this, just an example, hope it helps :)