AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

How to Save PDF from web

Ein Thema von Delphi-Lover · begonnen am 5. Sep 2005 · letzter Beitrag vom 5. Sep 2005
 
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#5

Re: How to Save PDF from web

  Alt 5. Sep 2005, 16:08
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
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:39 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz