.NET PDF Viewer SDK

.NET PDF Viewer SDK

Platform : Windows 10, Windows 8, Vista, Windows 7

With .NET PDF Viewer SDK , the developer can easily add PDF, TIFF viewer and Continuous scroll (like in Adobe Reader) capability to their application. 

Popular Solution Go   Back

C# - How to create Continuous scroll (like in Adobe Reader) PDF Viewer

Step 1: To install the .NET PDF Viewer SDK, begin by launching the setup file (http://www.viscomsoft.com/demo/dotnet_pdf_viewer_sdk_setup.exe). Select the desired installation folder for the .NET PDF Viewer SDK and continue with the installation on your development computer.


Step 2: Launch Visual Studio 2010 or another version of Visual Studio. Select Visual C#, Select Windows Form Application.



Step 3: In the Solution Explorer, right-click References, and then click Add Reference.



Step 4: Select Browse tab,  Navigate to the extracted  .NET PDF Viewer SDK for REDIST folder, open it, and then double-click Viscomsoft.PDFViewer.dll



Step 5: At the top of the Form1.cs file, add the following import statements to the top of the page

using Viscomsoft.PDFViewer;


Step 6: The following code bit presents the pdf viewer sdk initialization:

public partial class Form1 : Form
{

private PDFView _pdfViewer = new PDFView();

public Form1()
{

InitializeComponent();
_pdfViewer.Canvas.Parent = this;
_pdfViewer.Canvas.Location = new Point(0, 24);

}


Step 7: Load the PDF file.

private void Form1_Load(object sender, EventArgs e)
{
 PDFDocument doc = new PDFDocument();

  if (doc.open("c:\\yourfile.pdf"))
  {

  _pdfViewer.Document = doc;
  _pdfViewer.ContinuousPages = true;
  _pdfViewer.gotoPage(1);
  }
  else
   doc.close();


}


Step 8: Now that you can loaded a PDF file, but the display area is very small. so add following code to the Form1.cs file
private void resizeCanvas()
{
_pdfViewer.Canvas.Size = new Size(this.ClientSize.Width, this.ClientSize.Height - 24);
}

Step 9: add resizeCanvas() in Form1_Load event


private void Form1_Load(object sender, EventArgs e)
{
   resizeCanvas();

  PDFDocument doc = new PDFDocument();

  if (doc.open("c:\\yourfile.pdf"))
  {
  _pdfViewer.Document = doc;
  _pdfViewer.ContinuousPages = true;
  _pdfViewer.gotoPage(1);

  }
  else
   doc.close();
}

Step 10.  Select the form in the designer then go to the Properties Window and find the Events button

 

Step 11. Select Resize event and double click it.

Step 12. add resizeCanvas() in Form1_Resize event.

Step 13. Press F5 to Run the project, now it can loading and display the PDF document.

Download the source code of this Continuous scroll PDF Viewer Sample