如何在图片框中查看PDF [英] How can you view a PDF in a picture box

查看:86
本文介绍了如何在图片框中查看PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想知道是否有人可以帮助我。



我希望在图片框中查看PDF文件。如何做到这一点,或者有更好的方式来显示PDF文件。



当我显示PDF文件时,它显示但不在一个盒子里等等



提前谢谢

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

推荐答案

我遇到同样的问题,如何预览pdf文件在图片框中?然后保存?我正在使用vb.net 2008.



如果Me.oFileDialogBaja.ShowDialog()= DialogResult.OK那么

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
pBoxDocBaja.ImageLocation = oFileDialogBaja.FileName
                imgDocBaja = Image.FromFile(Me.oFileDialogBaja.FileName)
                Me.pBoxDocBaja.Image = imgDocBaja

                PDFSeleccionado = True







谢谢




Thanks


你可以尝试......我认为它不会起作用,但确认只是一个快速的测试项目。



现在,关于Adobe对象,这是你如何做的。



打开工具箱(如果尚未打开)。右键单击常规选项卡,然后单击选择项目。



单击名为COM组件的第二个选项卡,靠近顶部,您应该看到 Adobe PDF Reader。检查并点击确定。



现在您可以将对象拖到表单上。请注意,它会为您的项目添加两个引用:AcroPDFLib和AxAcroPDFLib。请注意,我安装了Acrobat 8​​和Reader 9,因此我的组件可能与您的组件略有不同...



如果你想摆脱工具栏并制作它只是PDF,你可以使用setShowToolbar方法。



这是演示代码 -

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-
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


试试这个链接。它可能会给你一些线索[ ^ ]
Try this link. It may give you some leads [^]


这篇关于如何在图片框中查看PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆