VB .NET Picturebox that Supports PDF VS 2008

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cellus205
    New Member
    • Sep 2008
    • 13

    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?

    Thanks

    mjs
  • cellus205
    New Member
    • Sep 2008
    • 13

    #2
    anyone have any suggestions?

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      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.

      Comment

      • cellus205
        New Member
        • Sep 2008
        • 13

        #4
        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?

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          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.

          Comment

          • cellus205
            New Member
            • Sep 2008
            • 13

            #6
            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)

            Code:
                    If openFileDialog1.ShowDialog() = DialogResult.OK Then
                        If openFileDialog1.FileName.EndsWith(".pdf") = True Or openFileDialog1.FileName.EndsWith(".PDF") = True Or openFileDialog1.FileName.EndsWith(".Pdf") = True Then
                            PictureBox1.Hide()
                            PDFPictureBox.LoadFile(openFileDialog1.FileName)
                            Panel1.AutoScrollMinSize = PDFPictureBox.Size()
                            PDFPictureBox.Show()
                        Else
                            PDFPictureBox.Hide()
                            PictureBox1.ImageLocation = openFileDialog1.FileName
                            PictureBox1.Load()
                            Panel1.AutoScrollMinSize = PictureBox1.Image.Size()
                            PictureBox1.Show()
                        End If
                    End If

            Comment

            • Curtis Rutland
              Recognized Expert Specialist
              • Apr 2008
              • 3264

              #7
              Glad you solved it =D

              Comment

              Working...