Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,

I wonder if anyone can help me.

I wish to view a PDF file in a picture box. How can this be done or is there any better way of display a PDF file.

At the moment when I display the PDF file it is displayed but not in a box etc.

Thanks in advance
Posted

I haver the same problem, how can I preview a pdf file in a picture box? and then save it? I´m using vb.net 2008.

If Me.oFileDialogBaja.ShowDialog() = DialogResult.OK Then
VB
pBoxDocBaja.ImageLocation = oFileDialogBaja.FileName
                imgDocBaja = Image.FromFile(Me.oFileDialogBaja.FileName)
                Me.pBoxDocBaja.Image = imgDocBaja

                PDFSeleccionado = True



Thanks
 
Share this answer
 
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.

Here is demo code-
VB
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
 
Share this answer
 
Try this link. It may give you some leads [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900