469,353 Members | 2,061 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

VB .NET Picturebox that Supports PDF VS 2008

Does anyone know of a picturebox component for VS 2008 that supports viewing PDF files? I need a picturebox that would support TIF, JPG, and PDF, and Im pretty sure the built in picturebox supports JPG And TIF, but it doesnt seem to support PDF. Does anyone know either a way that I can get the existing picturebox control to read PDFs or a component that would allow me to?


Nov 13 '08 #1
6 9062
anyone have any suggestions?
Nov 13 '08 #2
Curtis Rutland
3,256 Expert 2GB
Well, I know that you can use Adobe's COM object to view PDFs. But I don't think that there is a .net component that does all three.

You might be able to build one that switches it's components based on source...

Also, we'd like you to wait about 24 hours before bumping your own post.
Nov 13 '08 #3
ol, Sorry about the bump thing. Do you think I could use maybe a ReportViewer for the PDFs? Or would it be a better choice to try to try the Adobe COM?
Nov 13 '08 #4
Curtis Rutland
3,256 Expert 2GB
You could try....I don't think it will work, but confirmation is only a quick test project away.

Now, as to the Adobe object, here's how you do it.

Open up the Toolbox, if it isn't already open. Right click under the "General" tab, and click "Choose Items."

Click the second tab called "COM Components," and near the top you should see "Adobe PDF Reader." Check it and hit OK.

Now you can drag the object onto your form. Notice that it adds two references to your project: AcroPDFLib and AxAcroPDFLib. Note that I have Acrobat 8 and Reader 9 installed, so I may have slightly different components than you...

If you want to get rid of the toolbar and make it just the PDF, you can use the setShowToolbar method.
Nov 13 '08 #5
Thanks a lot man, that got it working for me. Just incase anyone needs something similar, heres the code I am using to load either pics or a pdf into a panel. (with both the picturebox and adobe pdf reader inside a panel)

Expand|Select|Wrap|Line Numbers
  1.         If openFileDialog1.ShowDialog() = DialogResult.OK Then
  2.             If openFileDialog1.FileName.EndsWith(".pdf") = True Or openFileDialog1.FileName.EndsWith(".PDF") = True Or openFileDialog1.FileName.EndsWith(".Pdf") = True Then
  3.                 PictureBox1.Hide()
  4.                 PDFPictureBox.LoadFile(openFileDialog1.FileName)
  5.                 Panel1.AutoScrollMinSize = PDFPictureBox.Size()
  6.                 PDFPictureBox.Show()
  7.             Else
  8.                 PDFPictureBox.Hide()
  9.                 PictureBox1.ImageLocation = openFileDialog1.FileName
  10.                 PictureBox1.Load()
  11.                 Panel1.AutoScrollMinSize = PictureBox1.Image.Size()
  12.                 PictureBox1.Show()
  13.             End If
  14.         End If
Nov 14 '08 #6
Curtis Rutland
3,256 Expert 2GB
Glad you solved it =D
Nov 14 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Phil Diwell | last post: by
reply views Thread by anthonyb | last post: by
3 posts views Thread by Brandon Arnold | last post: by
2 posts views Thread by xlar54 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.