pdf浏览器控件 DevExpress PDF Viewer

Use the DevExpress PDF Viewer Control to display PDF files directly in your WinForms application, without the need to install an external PDF viewer on your end-user's machine.

This tutorial illustrates how to embed a PDF Viewer in a Windows Forms application, to open, preview, navigate and print PDF documents without the need to install third-party software on the machine.

The tutorial consists of the following sections.

Create an Application and Add a PDF Viewer

  1. Run Microsoft® Visual Studio® 2010, 2012 or 2013.

  2. Start a new project (by pressing CTRL+SHIFT+N), and create a new Windows Forms Application.

  3. Open the Visual Studio designer and press CTRL+ALT+X to run the Toolbox. Expand the DX.14.1: Common Controls category, and drop the PdfViewer control onto the main form of the application.

Create and Customize a PDF Viewer Toolbar

To add a toolbar to the PDF Viewer, click the control's smart tag, and in the invoked actions list, select one of the following.

  • Create Ribbon

    This creates a ribbon illustrated in the following image.

    You can fully customize the ribbon afterwards, as well as select a different look and feel for it, via the smart tag of the toolbar.

  • Create Bars

    Instead of creating a ribbon, you can implement a bar interface. You can upgrade it to the ribbon interface at any time (e.g., when converting the entire application).

Load and Preview a PDF File

To load a document into the PDF Viewer, click the control's smart tag and select Load PDF File... in the actions list that is invoked.

The following code opens a PDF file at runtime.

CodeCentralShow Me

The complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E4696. Depending on the target platform type (ASP.NET, WinForms, etc), you can either run this example online or download an auto-executable sample.

The following example illustrates how to load an existing PDF file into the PdfViewer control. To do this, it's necessary to drop thePdfViewer control onto the form, create a Ribbon via the PdfViewer's smart tag and call the PdfViewer.LoadDocument method.

C#:Form1.cs
VB:Form1.vb
using System;
using System.Windows.Forms;

namespace PdfViewerSample {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            this.pdfViewer1.LoadDocument(@"..\..\Report.pdf");

        }
    }
}


Run the application and explore the PDF Viewer functionality.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值