GARANTIR DESCONTO

Fórum Exibir PDF salvo em banco #348622

07/11/2007

0

Bom dia a todos

Quero exibir um arquivo em PDF que está salvo no banco de dados, é possível?
Achei uma vídeo aula com o Guinther Pauli que mostra como mostrar salvo em disco.

Estou usando Delphi 2006, Firebird e DBExpress


Facc

Facc

Responder

Posts

07/11/2007

Rafael Mattos

Você pode salvar em uma pasta temporaria e depois abrir.


Responder

Gostei + 0

07/11/2007

Facc

Você pode salvar em uma pasta temporaria e depois abrir.


E como poderia ser feito?

TBlobField(Campo).SaveToFile(Caminho)


Seria isso?


Responder

Gostei + 0

07/11/2007

Rafael Mattos

Isso Mesmo.

Exemplo:

Salvando o arquivo
TBlobField(Campo).SaveToFile(´C:\Arquivo.pdf´);

Abrindo
ExecFile(´C:\Arquivo.pdf´);






Código da função ExecFile()
Inclua a unit SHELLAPI na clausula uses do seu form.


procedure TForm1.ExecFile(F: String);
var
r: String;
begin
case ShellExecute(Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of
ERROR_FILE_NOT_FOUND: r := ´The specified file was not found.´;
ERROR_PATH_NOT_FOUND: r := ´The specified path was not found.´;
ERROR_BAD_FORMAT: r := ´The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).´;
SE_ERR_ACCESSDENIED: r := ´Windows 95 only: The operating system denied access to the specified file.´;
SE_ERR_ASSOCINCOMPLETE: r := ´The filename association is incomplete or invalid.´;
SE_ERR_DDEBUSY: r := ´The DDE transaction could not be completed because other DDE transactions were being processed.´;
SE_ERR_DDEFAIL: r := ´The DDE transaction failed.´;
SE_ERR_DDETIMEOUT: r := ´The DDE transaction could not be completed because the request timed out.´;
SE_ERR_DLLNOTFOUND: r := ´Windows 95 only: The specified dynamic-link library was not found.´;
SE_ERR_NOASSOC: r := ´There is no application associated with the given filename extension.´;
SE_ERR_OOM: r := ´Windows 95 only: There was not enough memory to complete the operation.´;
SE_ERR_SHARE: r := ´A sharing violation occurred.´;
else
Exit;
end;
ShowMessage(r);
end;


Responder

Gostei + 0

07/11/2007

Facc

Isso Mesmo. Exemplo: Salvando o arquivo TBlobField(Campo).SaveToFile(´C:\Arquivo.pdf´); Abrindo ExecFile(´C:\Arquivo.pdf´); Código da função ExecFile() Inclua a unit SHELLAPI na clausula uses do seu form. procedure TForm1.ExecFile(F: String); var r: String; begin case ShellExecute(Handle, nil, PChar(F), nil, nil, SW_SHOWNORMAL) of ERROR_FILE_NOT_FOUND: r := ´The specified file was not found.´; ERROR_PATH_NOT_FOUND: r := ´The specified path was not found.´; ERROR_BAD_FORMAT: r := ´The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).´; SE_ERR_ACCESSDENIED: r := ´Windows 95 only: The operating system denied access to the specified file.´; SE_ERR_ASSOCINCOMPLETE: r := ´The filename association is incomplete or invalid.´; SE_ERR_DDEBUSY: r := ´The DDE transaction could not be completed because other DDE transactions were being processed.´; SE_ERR_DDEFAIL: r := ´The DDE transaction failed.´; SE_ERR_DDETIMEOUT: r := ´The DDE transaction could not be completed because the request timed out.´; SE_ERR_DLLNOTFOUND: r := ´Windows 95 only: The specified dynamic-link library was not found.´; SE_ERR_NOASSOC: r := ´There is no application associated with the given filename extension.´; SE_ERR_OOM: r := ´Windows 95 only: There was not enough memory to complete the operation.´; SE_ERR_SHARE: r := ´A sharing violation occurred.´; else Exit; end; ShowMessage(r); end;



Valeu!! Funcionou perfeitamente, mas surgiu uma dúvida, se meu cliente não tiver o leitor de PDF instalado? Gostaria que o PDF fosse aberto no form.


Estou usando Delphi 2006, Firebird e Trio DbExpress


Responder

Gostei + 0

07/11/2007

Rafael Mattos

Valeu!! Funcionou perfeitamente, mas surgiu uma dúvida, se meu cliente não tiver o leitor de PDF instalado? Gostaria que o PDF fosse aberto no form. Estou usando Delphi 2006, Firebird e Trio DbExpress


Mas mesmo para abrir no form vc precisaria ter o PDF instalado.


Responder

Gostei + 0

07/11/2007

Facc

[quote:44ab471390=´Facc´] Valeu!! Funcionou perfeitamente, mas surgiu uma dúvida, se meu cliente não tiver o leitor de PDF instalado? Gostaria que o PDF fosse aberto no form. Estou usando Delphi 2006, Firebird e Trio DbExpress


Mas mesmo para abrir no form vc precisaria ter o PDF instalado.[/quote:44ab471390]

essa é nova... hehehe

então tem como eu saber se existe o acrobat instalado? se não existir pedir pra instalar?


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar