• 9.0:EVO PDF Viewer Control for ASP.NET


    EVO PDF Viewer Control for ASP.NET

    EVO PDF Viewer control for ASP.NET can be linked into any ASP.NET application to add PDF visualization and manipulation capabilities to your ASP.NET application.

     

    EVO PDF Viewer Control for ASP.NET
    EVO PDF Viewer control for ASP.NET can be linked into any ASP.NET application to add PDF visualization and manipulation capabilities to your ASP.NET application. With EVO PDF Viewer for ASP.NET you can display a PDF from a specified URL or from stream of bytes into the client browser, control PDF security options to disable content copying or printing. The integration is extremely easy. The free Adobe Reader is required on the client computer where the control is displayed in browser.
     ASP.NET server control and C# samples
     Display a PDF document given as a stream of bytes
     Display PDF documents from a specified URL
     Navigate and print the document from browser
     Show or hide viewer toolbars
     Show or hide viewer scroll bars
     Show or hide viewer navigation panel
     Disable PDF document printing or copying
     Royalty free development libraries and samples
     Support for .NET 4.0 framework and later
     Documentation and C# samples for all the features

    Code Sample - PDF Viewer for ASP.NET

    The code below was taken from the PDF Viewer for ASP.NET demo application available for download in the product package. In this sample an instance of the PdfViewer class is used to display a PDF document in a browser.
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    
    // the HTML to PDF converter namespace
    using EvoPdf;
    
    // the PDF Viewer namespace
    using EvoPdf.PdfViewerAspNet;
    
    namespace PdfViewer4AspNetDemo
    {
        public partial class DisplayPdfBytes : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    LoadPageFitModes();
                    LoadDocumentDisplayModes();
    
                    LoadPdfStream();
                }
            }
    
    
            protected void btnConvert_Click(object sender, EventArgs e)
            {
                // apply the viewer settings before loading the PDF from stream
                ApplyViewerPreferences();
                ApplySecurityOptions();
    
                LoadPdfStream();
            }
    
            private void LoadPageFitModes()
            {
                string[] pageFitModes = Enum.GetNames(typeof(PageFitMode));
                ddlPageFitMode.DataSource = pageFitModes;
                ddlPageFitMode.DataBind();
                ddlPageFitMode.SelectedValue = pdfViewerControl.PageFitMode.ToString();
            }
    
            private void LoadDocumentDisplayModes()
            {
                string[] pageModes = Enum.GetNames(typeof(DocumentDisplayMode));
                ddlPageMode.DataSource = pageModes;
                ddlPageMode.DataBind();
                ddlPageMode.SelectedValue = pdfViewerControl.DocumentDisplayMode.ToString();
            }
    
            private void ApplyViewerPreferences()
            {
                pdfViewerControl.DocumentDisplayMode = 
                    (DocumentDisplayMode)Enum.Parse(typeof(DocumentDisplayMode), ddlPageMode.SelectedValue);
                pdfViewerControl.ShowNavigationPanel = cbShowWindowUI.Checked;
                pdfViewerControl.ShowScrollbars = cbShowScrollbars.Checked;
                pdfViewerControl.ShowToolbarMode = 
                    cbShowToolbar.Checked ? ShowToolbarMode.Show : ShowToolbarMode.Hide;
                pdfViewerControl.PageFitMode = 
                    (PageFitMode)Enum.Parse(typeof(PageFitMode), ddlPageFitMode.SelectedValue);
            }
    
            private void ApplySecurityOptions()
            {
                pdfViewerControl.PdfSecurityOptions.CanPrint = cbAllowPrint.Checked;
                pdfViewerControl.PdfSecurityOptions.CanCopyContent = cbAllowContentCopy.Checked;
                pdfViewerControl.PdfSecurityOptions.CanFillFormFields = cbAllowFormFilling.Checked;
                pdfViewerControl.PdfSecurityOptions.CanEditContent = cbAllowContentEdit.Checked;
                pdfViewerControl.PdfSecurityOptions.CanEditAnnotations = cbAllowEditAnnotations.Checked;
                pdfViewerControl.PdfSecurityOptions.CanAssembleDocument = cbAllowAssemble.Checked;
    
                pdfViewerControl.PdfSecurityOptions.UserPassword = textBoxUserPassword.Text.Trim();
            }
    
            private void LoadPdfStream()
            {
                //get the PDF stream
                string urlToConvert = textBoxURLToConvert.Text.Trim();
                byte[] pdfBytes = new PdfConverter().GetPdfBytesFromUrl(urlToConvert);
    
                // set the PDF bytes to be loaded in viewer
                pdfViewerControl.LicenseKey = "OLant6Kvt6e3ormnt6Smuaalua6urq4=";
                pdfViewerControl.PdfSourceBytes = pdfBytes;
            }
    
            protected void btnApplyViewerPreferences_Click(object sender, EventArgs e)
            {
                // update the viewer preferences
                ApplyViewerPreferences();
                ApplySecurityOptions();
            }
        }
    }
  • 相关阅读:
    软件测试/测试开发丨明确的编码规范,避免冗余和混乱
    DFS 、BFS、回溯
    [附源码]Python计算机毕业设计Django的高校资源共享平台
    【OpenCV】OpenCV (C++) 与 OpenCvSharp (C#) 之间数据通信
    WebSocket—STOMP详解(官方原版)
    水库大坝安全监测方案,筑牢水库安全防线!
    BPF 可移植性和 CO-RE(一次编译,到处运行)
    【SQLite】二、SQLite 和 HeidiSQL 的安装
    单调栈——包含min函数的栈
    Java Web中requset,session,application 的作用域及区别
  • 原文地址:https://blog.csdn.net/john_dwh/article/details/127645962