C#pdf Viewer

Source: Internet
Author: User

Free Spire.pdf for. NET was a Community Edition of the spire.pdf for. NET, which are a totally free PDF component F or commercial and personal use. As a standalone c#/vb.net component, free spire.pdf for. NET enables developers to create, write, edit, convert, print, ha Ndle and read PDF files on any. NET applications.

This article will cover the development of a simple PDF viewer using the E-iceblue plugin.

E-iceblue provides all plugins including office handling, address: http://www.e-iceblue.com/

http://www.e-iceblue.com/Introduce/free-pdf-component.html Download the free version of the PDF plugin after the installation is complete, you can see the following demo form. This form shows all the samples and codes for working with PDFs, and you can run the demo directly

The PDF plugin handles PDF Operations related to attachments, labeling, exporting, opening, paging, printing, storage, and more.

Create a new vs2012 WinForm program, import the corresponding version dll under C:\Program Files (x86) \e-iceblue\spire.pdfviewer-fe\bin vs2012 the toolbar,

Drag the Pfdviewer control onto the new form, and the Spire.pdfviewer reference is complete.

The This.pdfDocumentViewer1.LoadFromFile function is to load a PDF file, and the parameter is the file path.

The This.pdfDocumentViewer1.Print function is to print the current document.

Here's the code to get the annotations and go to the annotations

/// <summary>        ///get PDF Annotations/// </summary>        /// <param name= "Sender" ></param>        /// <param name= "E" ></param>        Private voidBtnattachmentannotation_click (Objectsender, EventArgs e) {             This. Tablelayoutpanel1.setrowspan ( This. PdfDocumentViewer1,1);  This. m_isattachmentannotation =true;  This. listview1.visible =true;  This. ListView1.Items.Clear ();  This. ListView1.Columns.Clear (); if( This. pdfdocumentviewer1.isdocumentloaded && This. Pdfdocumentviewer1.pagecount >0)            {                 This. Listview1.view =View.Details;  This. LISTVIEW1.COLUMNS.ADD ("Annotations", $);  This. LISTVIEW1.COLUMNS.ADD ("content", the);  This. LISTVIEW1.COLUMNS.ADD ("Page Number", the);  This. LISTVIEW1.COLUMNS.ADD ("location", the); //get a list of PDF annotationspdfdocumentattachmentannotation[] Annotations = This. Pdfdocumentviewer1.getattachmentannotaions (); if(Annotations! =NULL&& annotations. Length >0)                {                    //Annotation Properties                     for(inti =0; I < annotations. Length; i++) {pdfdocumentattachmentannotation annotation=Annotations[i]; ListViewItem Item=NewListViewItem (annotation.                        FileName); Item. SubItems.Add (annotation.                        Text); Item. SubItems.Add (annotation.                        Pageindex.tostring ()); Item. SubItems.Add (annotation.                        Location.tostring ()); Item. Tag=annotation;  This. LISTVIEW1.ITEMS.ADD (item); }                }            }        }        /// <summary>        ///go to Annotations/// </summary>        /// <param name= "Sender" ></param>        /// <param name= "E" ></param>        Private voidListview1_click (Objectsender, EventArgs e) {            if( This. M_isattachmentannotation) {pdfdocumentattachmentannotation annotation= (pdfdocumentattachmentannotation) This. listview1.selecteditems[0].                Tag;  This. pdfdocumentviewer1.gotoattachmentannotation (annotation); }        }

The final effect:

Cons: After countless document loading tests found some PDF document loading problems, as follows

A PDF software loads a document

Spire.pdfviewer a document that is loaded

SOURCE Download: http://download.csdn.net/detail/oyipiantian/8683459

C#pdf Viewer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.