添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Getting Started with Windows Forms PDF Viewer (PdfViewerControl)

18 Mar 2024 6 minutes to read

Adding reference to PdfViewerControl and dependent assemblies

Refer to the Control Dependencies section to get the list of assemblies.

Installing NuGet packages

Adding reference to Syncfusion assemblies through NuGet packages is illustrated in the NuGet Packages section.

NOTE

Starting with version 23.1.x, a reference to the Syncfusion.PdfToImageConverter.Base assembly is necessary for PdfViewer applications.
Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your Windows Forms application to use our components.

Adding from the installed location

The WinForms PDF Viewer (PdfViewerControl) and dependent assemblies can be found from the below location in your machine.

system drive:\Program Files (x86)\Syncfusion\Essential Studio\27.1.48\precompiledassemblies\27.1.48\

Adding PdfViewerControl to an Application

From v16.3.0x onwards, PDF Viewer uses PDFium as a default rendering engine to render the PDF pages, which is a more robust and promising rendering engine. Refer to this link for more details.

Adding in designer

Open your form in the designer. Add the Syncfusion controls to your .NET toolbox in Visual Studio if you haven’t done so already (the install would have automatically done this unless you selected not to complete toolbox integration during installation).

//Initializing the PdfViewerControl
PdfViewerControl pdfViewerControl1 = new PdfViewerControl();
//Add PdfViewerControl to the Form
Controls.Add(pdfViewerControl1);
//Docking the control to all edges of its containing control and sizing appropriately.
pdfViewerControl1.Dock = DockStyle.Fill;
//Loading the document in the PdfViewerControl
pdfViewerControl1.Load("Sample.pdf");
'Initializing the PdfViewerControl
Dim pdfViewerControl1 As PdfViewerControl = New PdfViewerControl()
'Add PdfViewerControl to the Form
Controls.Add(pdfViewerControl1)
'Docking the control to all edges of its containing control and sizing appropriately.
pdfViewerControl1.Dock = DockStyle.Fill
'Loading the document in the PdfViewerControl
pdfViewerControl1.Load("Sample.pdf")

Adding PdfDocumentView to an Application

The PdfDocumentView control allows you to view PDF files without a toolbar. Other features are similar to the PdfViewerControl.

Adding in designer

Open your form in the designer. Add the Syncfusion controls to your .NET toolbox in Visual Studio if you haven’t done so already (the install would have automatically done this unless you selected not to complete toolbox integration during installation).

//Initializing the PdfDocumentView
PdfDocumentView pdfDocumentView1 = new PdfDocumentView();
//Loading the document in the PdfDocumentView
pdfDocumentView1.Load("Sample.pdf");
//Add the PdfDocumentView to the Form
Controls.Add(pdfDocumentView1);
'Initializing the PdfDocumentView
Dim pdfDocumentView1 As PdfDocumentView = New PdfDocumentView()
'Loading the document in the PdfDocumentView
pdfDocumentView1.Load("Sample.pdf")
'Add the PdfDocumentView to the Form
Controls.Add(pdfDocumentView1)