把数据库blob字段用FoxitReaderSDK1显示PDF

 

procedure TAO_EWordPdf.ShowDoc;
var
   Adapter: iStream;//TStreamAdapter;

   DataLoader: TMemoryStream;
begin

 if not cdsGetDocDOC_DATA.IsNull then   //判断数据字段不为空
  begin

   DataLoader := TMemoryStream.Create();
    DataLoader.Clear;
    cdsGetDocDOC_DATA.SaveToStream(DataLoader);//将数据给DataLoader
    DataLoader.Position := 0;

     if LowerCase(Trim(cdsGetDocDOC_FILE_EXT.Value)) = '.pdf' then
      begin
        try
          Adapter := TStreamAdapter.Create(DataLoader);
          //FoxitReaderSDK1.CloseFile;
          SetDocTool(false);
          //dxBarManager1Bar1.Visible := False;
          FoxitReaderSDK1.Visible := True;
          FoxitReaderSDK1.ShowTitleBar(False);
          FoxitReaderSDK1.ShowBookmark(False);
          FoxitReaderSDK1.ShowStatusBar(False);
          FoxitReaderSDK1.UnLockActiveX('license_id', 'unlock_code');
          FoxitReaderSDK1.OpenStream(Adapter, '');//

        finally

            FreeAndNil(DataLoader);

        end;

    end;

end;

     

你可能感兴趣的:(reader)