how to view pdf file in vb.net?

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 95647 Views - Last Post: 08 December 2008 - 09:06 AM Rate Topic: -----

#1 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

how to view pdf file in vb.net?

Posted 30 November 2008 - 01:33 AM

i m planning to develop an application perform the task of displaying pdf document just the same as adobe acrobat reader. anybody has any idea how could it b done in vb.net?
Is This A Good Question/Topic? 0
  • +

Replies To: how to view pdf file in vb.net?

#2 bambi18  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 15
  • Joined: 02-November 08

Re: how to view pdf file in vb.net?

Posted 30 November 2008 - 02:44 AM

THIS WILL WORK.

System.Diagnostics.Process.Start("D:\test.pdf")
Was This Post Helpful? 0
  • +
  • -

#3 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 30 November 2008 - 09:29 AM

View Postbambi18, on 30 Nov, 2008 - 01:44 AM, said:

THIS WILL WORK.

System.Diagnostics.Process.Start("D:\test.pdf")



what if i m going to browse the pdf file location instead of specified it's URL...
Was This Post Helpful? 1

#4 baavgai  Icon User is online

  • Dreaming Coder
  • member icon

Reputation: 5777
  • View blog
  • Posts: 12,591
  • Joined: 16-October 07

Re: how to view pdf file in vb.net?

Posted 30 November 2008 - 09:36 AM

You can just include the browser widget in a form and point it. Haven't tested it, but it should work.
Was This Post Helpful? 0
  • +
  • -

#5 kasbaba  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 133
  • Joined: 03-November 08

Re: how to view pdf file in vb.net?

Posted 30 November 2008 - 02:28 PM

Hi,

you can also use a webbrowser control...add it to your form and then use the Navigate method...

myWebbrowser.navigate("d:\test.pdf")


this will open the pdf file inside your form...


hope this helps..


kasbaba
Was This Post Helpful? 0
  • +
  • -

#6 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 04:49 AM

View Postkasbaba, on 30 Nov, 2008 - 01:28 PM, said:

Hi,

you can also use a webbrowser control...add it to your form and then use the Navigate method...

myWebbrowser.navigate("d:\test.pdf")


this will open the pdf file inside your form...


hope this helps..


kasbaba


well, this is not exactly i expecting to do. i m expecting to do the pdf open by using button clicking function in menu item

File>Open>browse to targeted pdf file
Was This Post Helpful? 0
  • +
  • -

#7 Bort  Icon User is offline

  • Ill-informed Mongoloid
  • member icon

Reputation: 396
  • View blog
  • Posts: 2,919
  • Joined: 18-September 06

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 06:57 AM

Use an OpenFileDialog. It's like a pre-generated Open window.
Was This Post Helpful? 0
  • +
  • -

#8 kasbaba  Icon User is offline

  • D.I.C Head

Reputation: 28
  • View blog
  • Posts: 133
  • Joined: 03-November 08

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 09:25 AM

Hi,

I hope you were able to get it done.
However, incase you weren't able to do it then here is some code.....

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim Response As DialogResult
		OpenFileDialog1.FileName = ""
		OpenFileDialog1.Filter = "PDF Files(*.pdf)|*.pdf|All Files(*.*)|*.*"
		Response = OpenFileDialog1.ShowDialog()
		If Response <> Windows.Forms.DialogResult.Cancel Then
			If OpenFileDialog1.FileName <> "" Then
				WebBrowser1.Navigate(OpenFileDialog1.FileName)
			End If
		End If
	End Sub


kasbaba
Was This Post Helpful? 0
  • +
  • -

#9 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 09:48 AM

View Postkasbaba, on 1 Dec, 2008 - 08:25 AM, said:

Hi,

I hope you were able to get it done.
However, incase you weren't able to do it then here is some code.....

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Dim Response As DialogResult
		OpenFileDialog1.FileName = ""
		OpenFileDialog1.Filter = "PDF Files(*.pdf)|*.pdf|All Files(*.*)|*.*"
		Response = OpenFileDialog1.ShowDialog()
		If Response <> Windows.Forms.DialogResult.Cancel Then
			If OpenFileDialog1.FileName <> "" Then
				WebBrowser1.Navigate(OpenFileDialog1.FileName)
			End If
		End If
	End Sub


kasbaba


this is wat i m expecting to...thx a lot......

now i m proceeding to other button function for my application...
i wan to have a button tat perform the function of zoom in and zoom out function to the displayed pdf document.
i have an idea is to change the current page size from A3 to A5 for zoom out etc...not sure hw to implement in . NET


View PostBort, on 1 Dec, 2008 - 05:57 AM, said:

Use an OpenFileDialog. It's like a pre-generated Open window.



thx a lot...i got it.. :D
Was This Post Helpful? 0
  • +
  • -

#10 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 01:28 PM

If you want to have more control over the PDF viewer then instead of using the web browser control trick add the PDF Viewer ActiveX control directly to your application.

Right Click on Toolbox>Choose Items...>COM Components>Acrobat PDF Reader

Put a Acrobat PDF Reader control on your form and call PDFControlName.LoadFile() to open a PDF from your code and PDFControlName.setZoom() to zoom the document.
Was This Post Helpful? 0
  • +
  • -

#11 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 01 December 2008 - 08:41 PM

View Postmagicmonkey, on 1 Dec, 2008 - 12:28 PM, said:

If you want to have more control over the PDF viewer then instead of using the web browser control trick add the PDF Viewer ActiveX control directly to your application.

Right Click on Toolbox>Choose Items...>COM Components>Acrobat PDF Reader

Put a Acrobat PDF Reader control on your form and call PDFControlName.LoadFile() to open a PDF from your code and PDFControlName.setZoom() to zoom the document.


hi thr, from this method, if i am generated a executable file program. since i m using the Acrobat PDF Reader library, is it this will cause my executed program in error if it couldnt found the library in the particular location?
Was This Post Helpful? 0
  • +
  • -

#12 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: how to view pdf file in vb.net?

Posted 02 December 2008 - 06:43 AM

Yes the client computer will require acrobat reader installed, however the same condition applies to using the web browser control. You should place proper error handling around the Arobat control and notify the user that they must install acrobat reader to view PDFs.
Was This Post Helpful? 0
  • +
  • -

#13 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 07 December 2008 - 01:45 AM

View Postmagicmonkey, on 2 Dec, 2008 - 05:43 AM, said:

Yes the client computer will require acrobat reader installed, however the same condition applies to using the web browser control. You should place proper error handling around the Arobat control and notify the user that they must install acrobat reader to view PDFs.


I had been using the dynamic library provided by pdfnet for my pdf document reader, now i am able to view the pdf files and add on the basic functions of a document reader.
now i have an issue, i am able to generate a .exe file for my application but it cant work properly without the .dll library file in the same path and the resource file as well, it there any way that make all of that into a single file? instead of i need to carry 3 files together to run my application well.
Was This Post Helpful? 0
  • +
  • -

#14 magicmonkey  Icon User is offline

  • D.I.C Regular

Reputation: 106
  • View blog
  • Posts: 484
  • Joined: 12-September 08

Re: how to view pdf file in vb.net?

Posted 07 December 2008 - 08:48 AM

If the DLL is .NET then you can use this neat little utility called ILMerge.exe. It will merge the exe and dlls into a single exe. Link
Was This Post Helpful? 0
  • +
  • -

#15 kentck86  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 14
  • Joined: 30-November 08

Re: how to view pdf file in vb.net?

Posted 07 December 2008 - 10:19 AM

View Postmagicmonkey, on 7 Dec, 2008 - 07:48 AM, said:

If the DLL is .NET then you can use this neat little utility called ILMerge.exe. It will merge the exe and dlls into a single exe. Link



hi there, i got the ILMerge.exe utility, but i have no idea how will it works to merge the files....
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2