Asp.net C#生成pdf文件


把html文档直接生成pdf,不需要在服务器安装软件,可以在iis使用。
资源截图
代码片段和文件信息
using System;
using System.Drawing.Printing;
using System.Globalization;
using System.Threading;
using Common.Logging;

namespace Pechkin
{
    /// 
    /// Global configuration object. Is used to create converter objects.
    /// 
    /// It uses fluid notation to change its fields.
    /// 

    public class GlobalConfig
    {
        private string _paperSize = “A4“;
        private string _paperWidth; // for example “4cm“
        private string _paperHeight; // or “12in“
        private string _paperOrientation = “Portrait“; // must be either “Landscape“ or “Portrait“

        private string _colorMode = “Color“; // must be either “Color“ or “Grayscale“
        private string _resolution; // deprecated has no effect
        private string _dpi; // DPI used when printing like “80“

        private string _pageOffset; // start page number (used in headers footers and TOC)
        private string _copies; // number of copies to include into the document =)
        private string _collate = “false“; // collate copies or not must be either “true“ or “false“

        private string _outline = “false“; // generate table of contents must be either “true“ or “false“
        private string _outlineDepth = “4“; // outline depth
        private string _dumpOutline = ““; // filename to dump outline in xml format

        private string _output = ““; // filename to dump PDF into if “-“ then it‘s dumped into stdout
        private string _documenttitle; // title for the PDF document

        private string _useCompression = “true“; // turns on lossless compression of the PDF file

        private string _marginTop; // size of the top margin (ex. “2cm)
        private string _marginRight;
        private string _marginBottom;
        private string _marginLeft;

        private string _outputFormat = “pdf“; // can be “ps“ or “pdf“

        private string _imageDpi; // maximum DPI for the images in document
        private string _imageQuality; // specifies JPEG compression factor for the (reencoded) images in pdf from “0“ to “100“

        private string _cookieJar; // path to (text) file used to load and store cookies

        [Obsolete(“Setting paper size by name doesn‘t work in the lib. Use the overload that takes PaperKind instead.“)]
        public GlobalConfig SetPaperSize(string sizeName)
        {
            _paperSize = sizeName;

            _paperHeight = ““;
            _paperWidth = ““;

            return this;
        }
        public GlobalConfig SetPaperSize(PaperKind kind)
        {
            // don‘t work
            //return SetPaperSize(Enum.GetName(typeof(PaperKind) kind));

            if (PechkinStatic.PaperSizes.ContainsKey(kind))
            {
                PechkinStatic.StrPaperSize ps = PechkinStatic.PaperSizes[kind];

                return SetPaperSize(ps.Width ps.Height);
            }

            LogManager.GetCurrentClassLo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-11-22 09:57  Pechkin-master
     文件         146  2013-11-22 09:57  Pechkin-master.gitignore
     目录           0  2013-11-22 09:57  Pechkin-master.nuget
     文件         169  2013-11-22 09:57  Pechkin-master.nugetNuGet.Config
     文件        6698  2013-11-22 09:57  Pechkin-master.nugetNuGet.targets
     文件      619520  2013-11-22 09:57  Pechkin-master.nuget
uget.exe
     文件        3080  2013-11-22 09:57  Pechkin-masterPechkin.sln
     目录           0  2013-11-22 09:57  Pechkin-masterPechkin
     目录           0  2013-11-22 09:57  Pechkin-masterPechkinEventHandlers
     文件         131  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersBeginEventHandler.cs
     文件         125  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersErrorEventHandler.cs
     文件         122  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersFinishEventHandler.cs
     文件          89  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersLibDeInitEventHandler.cs
     文件          87  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersLibInitEventHandler.cs
     文件         156  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersPhaseChangedEventHandler.cs
     文件         159  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersProgressChangedEventHandler.cs
     文件         129  2013-11-22 09:57  Pechkin-masterPechkinEventHandlersWarningEventHandler.cs
     文件       16000  2013-11-22 09:57  Pechkin-masterPechkinGlobalConfig.cs
     文件        4807  2013-11-22 09:57  Pechkin-masterPechkinIPechkin.cs
     文件       36617  2013-11-22 09:57  Pechkin-masterPechkinobjectConfig.cs
     文件    16773780  2013-11-22 09:57  Pechkin-masterPechkinPechkin.0.5.8.1.nupkg
     文件        5644  2013-11-22 09:57  Pechkin-masterPechkinPechkin.csproj
     文件        1043  2013-11-22 09:57  Pechkin-masterPechkinPechkin.nuspec
     文件        6621  2013-11-22 09:57  Pechkin-masterPechkinPechkinBindings.cs
     文件       23517  2013-11-22 09:57  Pechkin-masterPechkinPechkinStatic.cs
     目录           0  2013-11-22 09:57  Pechkin-masterPechkinProperties
     文件        1526  2013-11-22 09:57  Pechkin-masterPechkinPropertiesAssemblyInfo.cs
     目录           0  2013-11-22 09:57  Pechkin-masterPechkinReference
     目录           0  2013-11-22 09:57  Pechkin-masterPechkinReferenceinclude
     文件        1928  2013-11-22 09:57  Pechkin-masterPechkinReferenceincludeconverter.hh
     文件        1475  2013-11-22 09:57  Pechkin-masterPechkinReferenceincludedllbegin.inc
............此处省略158个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)