zoukankan      html  css  js  c++  java
  • Silverlight 功能其全的PDF 控件

    最近在网上查询Silverlight HTML 的资料时,无意发现了一个好用的查看PDF文件的控件,以在推荐给大家,以下就英文原版,由于时间关系本人就不翻译了,看不懂的可以用GOOGLE 翻译一下,

    Silverlight viewer sample code

    The following section contains a brief description of the included SilverDox sample projects, found in SilverDoxSDK/Samples.


    +Tutorial Sample

    This is the simplest sample, illustating basic usage of a DocumentViewer to display a .xod file. The sample shows how to send and receive information to a DocumentViewer via data binding and direct method calls.

    A step-by-step description of creating this sample is included in the Getting Startedsection.

    Simple Silverlight document viewer

    Figure 1: DocumentViewer with External Controls.

    +ReaderControl Sample

    This sample shows the use of ReaderControl, which is a viewer built using DocumentViewer. The code for ReaderControl (a user control) is made available inSilverdoxSdk/Samples/ReaderControl.


    Reader Control Sample

    Figure 2: A ReaderControl created by the Reader Control Sample. A ReaderControl provies buttons for page navigation, a zoom slider, pan and text select modes, full text search, a thumbnail viewer and a bookmark viewer.

    +FlipBook Sample

    This sample does not use a DocumentViewer or ReaderControl, but rather acquires canvases directly from a Document, and uses the open-source Silverlight BookControls project to display the Document's pages.


    Silverlight Page Flip Sample

    Figure 3: The FlipBook Sample

    +FileBrowser Sample

    The FileBrowser sample implements a thumbnail-based file browser to load different documents into a ReaderControl.


    Silverlight Document Browser

    Figure 4: The FileBrowser Sample

    +Annotations Sample

    The Annotations sample shows how to use built-in support for various annotation types (including sticky notes, markup, text highlight/strikeout/underline, etc.) as well as how to add support for custom annotations.


    SilverDox Annotations Sample

    Figure 5: Annotations Sample

    Silverlight Document Publisher samples

    Silverlight document publisher is available as a command-line utility (called DocPub) or as an add-on option to PDFNet SDK. Both DocPub and PDFNet SDK are available on Windows, Linux, and Mac.

    The following sample illustrates how to convert PDF, XPS, image, MS Office, and other image document formats to Silverlight XPS format (also know as XOD).

    Certain file formats such as PDF, generic XPS, EMF, and raster image formats can be directly converted to Silverlight XPS (XOD). Other formats such as MS Office (Word, Excel, Publisher, Powerpoint, etc) can be directly converted via interop. These types of conversions guarantee optimal output, while preserving important information such as document metadata, intra document links and hyper-links, bookmarks etc.

    In case there is no direct conversion available, PDFNet can still convert from any printable document to Silverlight XPS using a virtual printer driver. To check if a virtual printer is required use Convert::RequiresPrinter(filename). In this case the installing application must be run as administrator. The manifest for this sample specifies appropriate the UAC elevation. The administrator privileges are not required for direct or interop conversions.

    Please note that 'pdftron.PDF.Convert.ToSilverlight' is part of PDFTron SilverDox publishing platform which can also be licensed as an extension to PDFNet SDK.

    C# Download
    Java Download
    C/C++ Download
    VB.Net Download

    以下为主要的后台代码(C#):

    using System;
    using System.Drawing;
    using System.Drawing.Drawing2D;

    using pdftron;
    using pdftron.Common;
    using pdftron.Filters;
    using pdftron.SDF;
    using pdftron.PDF;

    namespace SilverlightConvertTestCS
    {
    /// <summary>
    /// The following sample illustrates how to convert PDF, XPS, image, MS Office, and
    /// other image document formats to Silverlight XPS format (know as XOD).
    ///
    /// Certain file formats such as PDF, generic XPS, EMF, and raster image formats can
    /// be directly converted to Silverlight XPS (XOD). Other formats such as MS Office
    /// (Word, Excel, Publisher, Powerpoint, etc) can be directly converted via interop.
    /// These types of conversions guarantee optimal output, while preserving important
    /// information such as document metadata, intra document links and hyper-links,
    /// bookmarks etc.
    ///
    /// In case there is no direct conversion available, PDFNet can still convert from
    /// any printable document to Silverlight XPS using a virtual printer driver. To check
    /// if a virtual printer is required use Convert::RequiresPrinter(filename). In this
    /// case the installing application must be run as administrator. The manifest for this
    /// sample specifies appropriate the UAC elevation. The administrator privileges are
    /// not required for direct or interop conversions.
    ///
    /// Please note that 'pdftron.PDF.Convert.ToSilverlight' is part of PDFTron SilverDox
    /// publishing platform which can be licensed as an extension to PDFNet SDK.
    /// For details please see http://www.pdftron.com/silverdox.
    /// </summary>
    class Testfile
    {
    public string inputFile, outputFile;
    public Testfile(string inFile, string outFile)
    {
    inputFile
    = inFile;
    outputFile
    = outFile;
    }
    };

    class Class1
    {
    // Relative path to the folder containing test files.
    const string inputPath = "http://www.cnblogs.com/http://www.cnblogs.com/TestFiles/";
    const string outputPath = "http://www.cnblogs.com/http://www.cnblogs.com/TestFiles/Output/";

    static void BulkConvertRandomFilesToSilverlight()
    {
    System.Collections.ArrayList testfiles
    = new System.Collections.ArrayList();
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("simple-powerpoint_2007.pptx", "simple-powerpoint_2007.xod"));
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("simple-word_2007.docx", "simple-word_2007.xod"));
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("butterfly.png", "butterfly.xod"));
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("numbered.pdf", "numbered.xod"));
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("dice.jpg", "dice.xod"));
    testfiles.Add(
    new SilverlightConvertTestCS.Testfile("simple-xps.xps", "simple-xps.xod"));

    foreach (Testfile file in testfiles)
    {
    try
    {
    if (pdftron.PDF.Convert.RequiresPrinter(inputPath + file.inputFile))
    {
    Console.WriteLine(
    "Printing file: " + file.inputFile);
    }

    pdftron.PDF.Convert.ToSilverlight(inputPath
    + file.inputFile, outputPath + file.outputFile);
    Console.WriteLine(
    "Converted file: " + file.inputFile);
    Console.WriteLine(
    " to silverlight: " + file.outputFile);
    }
    catch (PDFNetException e)
    {
    Console.WriteLine(
    "ERROR: on input file " + file.inputFile);
    Console.WriteLine(e.Message);
    }
    }
    }

    /// <summary>
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    PDFNet.Initialize();

    // Sample 1:
    // Directly convert from PDF to Silverlight XPS (XOD).
    pdftron.PDF.Convert.ToSilverlight(inputPath + "newsletter.pdf", outputPath + "from_pdf.xps");

    // Sample 2:
    // Directly convert from generic XPS to Silverlight XPS (XOD).
    pdftron.PDF.Convert.ToSilverlight(inputPath + "simple-xps.xps", outputPath + "from_xps.xps");

    // Sample 3:
    // Convert from MS Office (does not require printer driver for Office 2007+)
    // and other document formats to Silverlight XPS (XOD).
    BulkConvertRandomFilesToSilverlight();

    Console.WriteLine(
    "Done.");
    }
    }
    }




    激情燃烧
  • 相关阅读:
    Vim命令合集
    感知机算法
    【项目】搜索广告CTR预估(二)
    【项目】搜索广告CTR预估(一)
    Kernel Logestic Regression
    SVM3 Soft Margin SVM
    Bias and Variance
    SVM2---核函数的引入
    贪心题目汇总
    Divergent series
  • 原文地址:https://www.cnblogs.com/waren168/p/2063955.html
Copyright © 2011-2022 走看看