Hi folks,
I just imported the Adobe Acrobat 7.0 Browser Control Type Library 1.0 just to find out what Bernhard mentioned - the interface is a very scarce resource. But although the requested functionality is not exported directly by the
COM interface, the functions are there all the same.
The Browser Control is perfectly capable to write pdf documents to your hard drive. By processing this tiny piece of code the well known toolbar is exposed and you can save a copy of the document:
Delphi-Quellcode:
procedure TDemoForm.DemoButtonClick(Sender: TObject);
begin
with AcroPdf do begin
setShowToolbar(true);
LoadFile('c:\daten\download.pdf');
end;
end;
Since the LoadFile() method does not accept a
URL, I conclude, that the Internet Explorer does the download part and knows a way to inform AcroPdf. Those who have
access to the Acrobat
SDK should be able to find out about the other interfaces supported via AcroPdf.ControlInterface or the command identifiers handled by AcroPdf.DoObjectVerb().
The rest of us can use the function GetInetFile() posted above. Or give the
indy http client a try:
Delphi-Quellcode:
procedure Download(
url, filename:
string);
var
fs: TFileStream;
http: TIdHttp;
begin
fs := TFileStream.Create(fileName, fmCreate);
http := TIdHttp.Create(
nil);
http.Get(
url, fs);
http.Free;
fs.Free;
end;
So long
marabu