Image Viewer CP Pro SDK ActiveX

Image Viewer CP Pro SDK ActiveX

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

It is a PDF Viewer and Document Viewer SDK , Export to PDF ,Image processing, 1D and 2D Barcode Reader, Writer, DICOM and OCR with C#, C++, VB.NET , VB, Delphi, Vfp, MS Access.

Popular Solution Go   Back

C# - How to Add display Multipage PDF features to WinForm application from NuGet Packages

Step 1: Close the Visual Studio 2019.

Step 2: Run the Visual Studio 2019  as Administrator.  Right click on your VS product and select Run as administrator.

Step 3: Select Visual C# or Visual Basic, Select Windows Form Application.

Step 4: Select your project in Solution Explorer, Right click the mouse, select Manage NuGet Packages...

This brings up the NuGet Package Manager, enter "imageviewerpro" in search textbox , then select Viscomsoft.ImageViewerProControl.WinForms.x86 package and click Install button.

Step 5: Now you will see DllRegisterServer in ImageViewer2.ocx successful Message Box. If not, you should close the Visual Studio 2019. Run the Visual Studio 2019  as Administrator again.

 

Step 6: Select Toolbox, select Components item, right click mouse button, select Choose Items...

 

Step 7:  Select COM Components tab, select Image Viewer CP Pro ActiveX Control, Click OK.


Step 8: Now the Image Viewer CP Pro ActiveX Control's icons will display on Toolbox.
Step 9: Now the Image Viewer CP  Pro Control's icon will display on Toolbox. Drag the Image Viewer CP  Pro Control from toolbar to form and add three buttons on form, change the Text property of the buttons to "Load", "Previous", "Next.

Step 10:  Double click the Load button,  Then add the following code to the top of the page. 
 int _iCurrentPage = 1;
 // Change this to the path of your PDF file
 string _strPDFFile= "c:\yourfolder\yourpdf.pdf";
 int _iTotalPage = 0;
 
 public Form1()
 {
  InitializeComponent();
  }
Step 11. Add the below code on button1_Click.

 private void button1_Click(object sender, EventArgs e)
{
       axImageViewer1.PDFUseAdvancedViewer = true;
        axImageViewer1.LoadMultiPage(_strPDFFile, 1);
        _iTotalPage = axImageViewer1.GetTotalPage();
        axImageViewer1.View = 9;
}


Step 12. Double click the Previous button. Add the below code on button2_Click
private void button2_Click(object sender, EventArgs e)
{
       _iCurrentPage = _iCurrentPage - 1;
       if (_iCurrentPage < 1)
         _iCurrentPage = 1;
axImageViewer1.LoadMultiPage(_strPDFFile, (short)_iCurrentPage);
}

Step 13. Double click the Next button. Add the below code on button3_Click
private void button3_Click(object sender, EventArgs e)
{
        _iCurrentPage = _iCurrentPage 1;
         if (_iCurrentPage > _iTotalPage)
                _iCurrentPage = _iTotalPage;
         axImageViewer1.LoadMultiPage(_strPDFFile, (short)_iCurrentPage);
}

Step 14. Press F5 run the project, click Load button to display the PDF file.