|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Print pdf from Internet Explorer using VB .NETI have a program that does the following: When a user clicks on a row in a VB.NET datagrid, it will open a web page in Internet Explorer (that corresponds to that item in the selected row in the datagrid). It will automatically print that web page, and then it will close the Internet Explorer window. I have code that works perfectly when a regular web page is opened, however when a pdf web page is opened the printing never occurs. Any help would be greatly appreciated. The reason for the datagrid is that ultimately the user should be able to select many rows and have all the web pages print without any user intervention. Thank you! Mrs_Mcse My VB.NET code is: If DataGrid1.IsSelected(0) = True Then Dim selectedItem As Object selectedItem = DataGrid1.Item(0, 4) 'For testing purposes, just use the first row in the datagrid and use column 4 that contains a web url Dim cellValue As String cellValue = selectedItem Dim Explorer As SHDocVw.InternetExplorer Explorer = New SHDocVw.InternetExplorer Explorer.Visible = True Explorer.Navigate(cellValue) Do Loop Until Explorer.Busy = False Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) End If Wendy wrote:
Show quoteHide quote > Hello, Why not host the page inside vb.net instead of launching IE? Then you > > I have a program that does the following: > When a user clicks on a row in a VB.NET datagrid, it will open a web page in > Internet Explorer (that corresponds to that item in the selected row in the > datagrid). It will automatically print that web page, and then it will close > the Internet Explorer window. I have code that works perfectly when a > regular web page is opened, however when a pdf web page is opened the > printing never occurs. Any help would be greatly appreciated. The reason > for the datagrid is that ultimately the user should be able to select many > rows and have all the web pages print without any user intervention. Thank > you! Mrs_Mcse > > My VB.NET code is: > > If DataGrid1.IsSelected(0) = True Then > > Dim selectedItem As Object > selectedItem = DataGrid1.Item(0, 4) > 'For testing purposes, just use the first row in the datagrid > and use column 4 that contains a web url > Dim cellValue As String > cellValue = selectedItem > > Dim Explorer As SHDocVw.InternetExplorer > Explorer = New SHDocVw.InternetExplorer > Explorer.Visible = True > Explorer.Navigate(cellValue) > Do > > Loop Until Explorer.Busy = False > > Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, > SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) > > End If can print it yourself. Chris Hi Chris,
Sorry, but this is the only way that I know. Would you please tell me, at least in general terms, how to accomplish what you suggest? Thank you so much, Wendy Show quoteHide quote "Chris" wrote: > Wendy wrote: > > Hello, > > > > I have a program that does the following: > > When a user clicks on a row in a VB.NET datagrid, it will open a web page in > > Internet Explorer (that corresponds to that item in the selected row in the > > datagrid). It will automatically print that web page, and then it will close > > the Internet Explorer window. I have code that works perfectly when a > > regular web page is opened, however when a pdf web page is opened the > > printing never occurs. Any help would be greatly appreciated. The reason > > for the datagrid is that ultimately the user should be able to select many > > rows and have all the web pages print without any user intervention. Thank > > you! Mrs_Mcse > > > > My VB.NET code is: > > > > If DataGrid1.IsSelected(0) = True Then > > > > Dim selectedItem As Object > > selectedItem = DataGrid1.Item(0, 4) > > 'For testing purposes, just use the first row in the datagrid > > and use column 4 that contains a web url > > Dim cellValue As String > > cellValue = selectedItem > > > > Dim Explorer As SHDocVw.InternetExplorer > > Explorer = New SHDocVw.InternetExplorer > > Explorer.Visible = True > > Explorer.Navigate(cellValue) > > Do > > > > Loop Until Explorer.Busy = False > > > > Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, > > SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) > > > > End If > > Why not host the page inside vb.net instead of launching IE? Then you > can print it yourself. > > Chris > Hi Wendy,
A little example, Open a new windows application project In the toolbox rightclick and select add/Remove items In the customize toolbox select Com and in that Microsoft Webbrowser (This with 1.1 in 2.0 it is already in the toolbox) When that is in the toolbox drag it to your form Drag also a button to your form. Then this code and you have a mini Webbrowser. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.AxWebBrowser1.Navigate2("www.google.com") End Sub Don't instance in 1.1 the webbrowser in code there is a lot placed in the RESX file with that method. I hope this helps a little bit? Cor Show quoteHide quote "Wendy" <We***@discussions.microsoft.com> schreef in bericht news:D7B4D07C-6587-4100-ACFC-14CE891BB4E9@microsoft.com... > Hi Chris, > > Sorry, but this is the only way that I know. Would you please tell me, at > least in general terms, how to accomplish what you suggest? > > Thank you so much, > > Wendy > > "Chris" wrote: > >> Wendy wrote: >> > Hello, >> > >> > I have a program that does the following: >> > When a user clicks on a row in a VB.NET datagrid, it will open a web >> > page in >> > Internet Explorer (that corresponds to that item in the selected row in >> > the >> > datagrid). It will automatically print that web page, and then it will >> > close >> > the Internet Explorer window. I have code that works perfectly when a >> > regular web page is opened, however when a pdf web page is opened the >> > printing never occurs. Any help would be greatly appreciated. The >> > reason >> > for the datagrid is that ultimately the user should be able to select >> > many >> > rows and have all the web pages print without any user intervention. >> > Thank >> > you! Mrs_Mcse >> > >> > My VB.NET code is: >> > >> > If DataGrid1.IsSelected(0) = True Then >> > >> > Dim selectedItem As Object >> > selectedItem = DataGrid1.Item(0, 4) >> > 'For testing purposes, just use the first row in the >> > datagrid >> > and use column 4 that contains a web url >> > Dim cellValue As String >> > cellValue = selectedItem >> > >> > Dim Explorer As SHDocVw.InternetExplorer >> > Explorer = New SHDocVw.InternetExplorer >> > Explorer.Visible = True >> > Explorer.Navigate(cellValue) >> > Do >> > >> > Loop Until Explorer.Busy = False >> > >> > Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, >> > SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) >> > >> > End If >> >> Why not host the page inside vb.net instead of launching IE? Then you >> can print it yourself. >> >> Chris >> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message But that still won't activate the pdf viewer inside IE and make it print. news:OqrmsC0QGHA.4696@tk2msftngp13.phx.gbl... > When that is in the toolbox drag it to your form > Drag also a button to your form. > > Then this code and you have a mini Webbrowser. That's the tricky part. Homer,
> But that still won't activate the pdf viewer inside IE and make it print. But that was not the question from Wendy I was answered.> That's the tricky part. > In here reply to Chris she asked how to create an inbuild webbrowswer. So please read first before you write. Cor "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message You first.news:%234tMKZ0QGHA.3192@TK2MSFTNGP09.phx.gbl... > So please read first before you write. Homer J Simpson wrote:
Show quoteHide quote > "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message The system should detect that a PDF has been asked for and handle that > news:OqrmsC0QGHA.4696@tk2msftngp13.phx.gbl... > > >>When that is in the toolbox drag it to your form >>Drag also a button to your form. >> >>Then this code and you have a mini Webbrowser. > > > But that still won't activate the pdf viewer inside IE and make it print. > That's the tricky part. > > > seperate from a web page. Chris "Wendy" <We***@discussions.microsoft.com> wrote in message Isn't that because you need to use the pdf printing function and not the IE news:4594A7D5-B129-4F18-B5CE-47156569E0AD@microsoft.com... > I have code that works perfectly when a > regular web page is opened, however when a pdf web page is opened the > printing never occurs. printing function? Perhaps you need to find a way to send that message to the pdf display addon. Your idea makes sense to me, but I don't know where to begin. Can you
suggest anything? Thank you. Show quoteHide quote "Homer J Simpson" wrote: > > "Wendy" <We***@discussions.microsoft.com> wrote in message > news:4594A7D5-B129-4F18-B5CE-47156569E0AD@microsoft.com... > > > I have code that works perfectly when a > > regular web page is opened, however when a pdf web page is opened the > > printing never occurs. > > Isn't that because you need to use the pdf printing function and not the IE > printing function? Perhaps you need to find a way to send that message to > the pdf display addon. > > > > "Wendy" <We***@discussions.microsoft.com> wrote in message I would explore to see if you can find a way to link to the Adobe software. news:9A0B3CE9-2DEE-4AD6-87E5-0DA4CC9A4EB3@microsoft.com... > Your idea makes sense to me, but I don't know where to begin. Can you > suggest anything? Try add a reference, COM, and look for Adobe stuff. You could also use SendKeys.Send("^P") from your program but it's not always reliable and you may need to figure out how to activate the webrowser app first. hi
actually i want to know that can i open the same vb.net application means windows application in the internet explorer? if yes then say me how ? i have urgent need for this answer . Wendy wrote: Show quoteHide quote > Hello, > > I have a program that does the following: > When a user clicks on a row in a VB.NET datagrid, it will open a web page in > Internet Explorer (that corresponds to that item in the selected row in the > datagrid). It will automatically print that web page, and then it will close > the Internet Explorer window. I have code that works perfectly when a > regular web page is opened, however when a pdf web page is opened the > printing never occurs. Any help would be greatly appreciated. The reason > for the datagrid is that ultimately the user should be able to select many > rows and have all the web pages print without any user intervention. Thank > you! Mrs_Mcse > > My VB.NET code is: > > If DataGrid1.IsSelected(0) = True Then > > Dim selectedItem As Object > selectedItem = DataGrid1.Item(0, 4) > 'For testing purposes, just use the first row in the datagrid > and use column 4 that contains a web url > Dim cellValue As String > cellValue = selectedItem > > Dim Explorer As SHDocVw.InternetExplorer > Explorer = New SHDocVw.InternetExplorer > Explorer.Visible = True > Explorer.Navigate(cellValue) > Do > > Loop Until Explorer.Busy = False > > Explorer.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINTPREVIEW, > SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_PROMPTUSER) > > End If
Starting a Windows app from a windows service
need ideas on multi threaded db update Extending the TreeNode - - -> HELP! get a listing of assemblies from GAC ? "Specified cast is not valid" converting from object A to object B Best Way to Import Fixed Width Files XML Help wanted Copying a project... How to load AVI's from shell32.dll & play them? Image Analysis, OCR |
|||||||||||||||||||||||