473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Save a pdf file when opened in a browser object

And
I use shdocvw InternetExplorer Object to open a pdf file and then I
want to automatically save it but the web site from wich I'm
downloading the file doesn't allows to save the file using the
webrequest command so my idea is to save it using the save command from
the internet explorer but it still doen't work!

The code I am using is the following:

Private Sub BtnSave_Click()
Dim eQuery As OLECMDID
Dim bb As Object
bb = CreateObject("InternetExplorer.Application")
bb.navigate("http://somedomain.com/file.pdf")
bb.visible = True
Do While (bb.busy Or bb.readystate <> 4)
System.Threading.Thread.Sleep(50)
Loop

On Error Resume Next
eQuery = bb.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_SAVE)
If Err.Number = 0 Then
If eQuery And SHDocVw.OLECMDF.OLECMDF_ENABLED Then
bb.ExecWB(SHDocVw.OLECMDID.OLECMDID_SAVE,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER , "", "")
Else
MsgBox("The Print command is currently disabled.")
End If
End If
If Err.Number <> 0 Then MsgBox("Print command Error: " &
Err.Description)

End Sub
The code works just fine with html pages (changing
SHDocVw.OLECMDID.OLECMDID_SAVE to SHDocVw.OLECMDID.OLECMDID_SAVEAS) but
it doesn't work when ie is displaying a pdf file.

Can anyone help me

Tks in advance

And

May 11 '06 #1
0 2472

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
by: Curious Angel | last post by:
I have a resume in PDF format and I want anyone who LEFT-OR-RIGHT clicks the link to force the file to be saved, and in any event _not_ opened. Since the PDF will be in his cache in any event, I...
7
by: joseph.inglis | last post by:
I have a web browser object on a form which I have set to edit mode and use the UCOMIConnectionPointContainer interface to hook in and catch events. All working sweetly. Except there...
4
by: Jae | last post by:
I'm writing a web application that exports and imports excel files. The application gets a list of users and their info and displays it in a datagrid .The user then selects to save the file as a...
4
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response ...
4
by: randmCP | last post by:
Hi and thanks in advanced for you help. I am working on a file-distribution asp.net application. Users click on a custom grid column to download files stored on a SQL DB. The client does not want...
4
by: sunilj20 | last post by:
Hello, I have a requirement wherein, a user clicks on a file name in an ASP.NET web application, and the file should automatically be downloaded (Without showing the "Open", "Save As") in the...
0
by: Matt Schwartz | last post by:
I have a ASP.NET web application written using VB.NET. I have a data grid, that is sent to the browser as an excel document using the following code Private Sub CreateXLS(ByVal xdatagrid As...
3
by: S_K | last post by:
Hi, I have a problem when I try to save a .CSV file from an ASP.NET web page and the client has Excel open already. The symptoms are: 1) The web page is currently displaying the Excel...
2
by: KC-Mass | last post by:
I have a form that is used to ID and then load Excel files into Access. I use labels on the form to record which file was last loaded. That was accomplished with a simple lblFileLoaded =...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.