Discussion:
Download a PDF
(too old to reply)
null
2007-01-22 22:00:46 UTC
Permalink
I have used the InternetOpen, InternetOpenUrl, and InternetReadFile
functions to retrieve the following into my C++ program.

<html>
<head>
<script language="javascript">
if (window.focus) { window.focus() }
</script>
</head>
<frameset rows="*,1" frameborder=no>
<frame
src="/cgi-bin/upload.dll/file.pdf?95a95b483bd74dac9d49f88570927c28"
noresize>
<frame src="blank.asp">
</frameset>
</html>

What wininet functions do I use to retrieve the contents of file.pdf so
that I can write it to a file so that I can read it with Adobe? Using
Windows XP sp2 if that matters.
Dan Mitchell
2007-01-23 00:32:13 UTC
Permalink
Post by null
src="/cgi-bin/upload.dll/file.pdf?95a95b483bd74dac9d49f88570927c28"
noresize>
What wininet functions do I use to retrieve the contents of file.pdf so
that I can write it to a file so that I can read it with Adobe? Using
Windows XP sp2 if that matters.
Why can't you just use InternetReadFile again -- just stick the name of
the server you're using in front of "/cgi-bin/...", and there you go.
You'll almost certainly have to put the entire "file.pdf?...." into the
URL, but that depends on how the server you're requesting it from works.

(at least, that's assuming that it gives you a valid URL if you do that
and paste it into IE).

Chances are you'll have to write a loop to read the file a chunk at a
time unless you know for sure how large the file is (or allocate a buffer
to read it into that's bigger than any possible PDF you'll hit), but then
you can just dump it straight out to disk as you do so.

-- dan
null
2007-01-23 15:08:20 UTC
Permalink
Post by Dan Mitchell
Why can't you just use InternetReadFile again -- just stick the name of
the server you're using in front of "/cgi-bin/...", and there you go.
You'll almost certainly have to put the entire "file.pdf?...." into the
URL, but that depends on how the server you're requesting it from works.
(at least, that's assuming that it gives you a valid URL if you do that
and paste it into IE).
Chances are you'll have to write a loop to read the file a chunk at a
time unless you know for sure how large the file is (or allocate a buffer
to read it into that's bigger than any possible PDF you'll hit), but then
you can just dump it straight out to disk as you do so.
-- dan
Thanks. I'll give it a try and report back. I am a long time
programmer but new to using wininet. I was quite pleased when I got the
html to load into my program.
null
2007-01-23 21:02:29 UTC
Permalink
Post by null
Post by Dan Mitchell
Why can't you just use InternetReadFile again -- just stick the name
of the server you're using in front of "/cgi-bin/...", and there you
go. You'll almost certainly have to put the entire "file.pdf?...."
into the URL, but that depends on how the server you're requesting it
from works.
(at least, that's assuming that it gives you a valid URL if you do
that and paste it into IE).
Chances are you'll have to write a loop to read the file a chunk at a
time unless you know for sure how large the file is (or allocate a
buffer to read it into that's bigger than any possible PDF you'll
hit), but then you can just dump it straight out to disk as you do so.
-- dan
Thanks. I'll give it a try and report back. I am a long time
programmer but new to using wininet. I was quite pleased when I got the
html to load into my program.
Works fine. The problem I has was that the pdf contains embedded 0x00's
so the data cannot be handled as a c string.

Loading...