详解高效而稳定的企业级.NET Office 组件Spire(.N(2)

以上的方法中只是操作PDF部分类,由于包含的类较多,过大的介绍篇幅就显得多余,在对PDF的操作中提供了较多的方法,因此在功能上会较为的丰富,使用起来也较为的便捷。

  1.PdfDocument类:声明PDF文档:

(1).PdfDocument类的构造函数:

public PdfDocument(); public PdfDocument(string filename); public PdfDocument(byte[] bytes); public PdfDocument(Stream stream); public PdfDocument(string filename, string password); public PdfDocument(byte[] bytes, string password); public PdfDocument(Stream stream, string password);

该类提供了7个构造函数的重载版本,对应的参数类型就不做详细的介绍

(2).PdfDocument.LoadFromHTML():加载HTML页面:

public void LoadFromHTML(string Url, bool enableJavaScript, bool enableHyperlinks, bool autoDetectPageBreak) { // This item is obfuscated and can not be translated. PdfHtmlLayoutFormat format; int num; goto Label_001E; Label_008F: num = 0; Label_0002: switch (num) { case 0: break; case 1: if (!autoDetectPageBreak) { format.Layout = PdfLayoutType.OnePage; format.FitToPage = Clip.Width; format.FitToHtml = Clip.Height; num = 2; } else { num = 3; } goto Label_0002; case 2: switch ((1 == 1)) { case 2: goto Label_008F; } if (0 != 0) { } break; case 3: format.Layout = PdfLayoutType.Paginate; format.FitToPage = Clip.Width; goto Label_008F; default: goto Label_001E; if (1 != 0) { } format = new PdfHtmlLayoutFormat(); num = 1; goto Label_0002; } this.Sections.Add().LoadFromHTML(Url, enableJavaScript, enableHyperlinks, format); }

2.HtmlConverter名称空间:Html转换器。

namespace Spire.Pdf.HtmlConverter { public enum AspectRatio public enum Clip [ToolboxItem(false)] public class HtmlConverter : UserControl, sprᰐ, sprᶪ, sprṳ, sprẝ, sprẏ public enum ImageType public class PdfHtmlLayoutFormat }

private Metafile (); static HtmlConverter(); public HtmlConverter(); public int Authenticate(ref IntPtr phwnd, ref IntPtr pszUsername, ref IntPtr pszPassword); public HtmlToPdfResult Convert(string url, ImageType type, int width, int height, AspectRatio aspectRatio); public HtmlToPdfResult Convert(string html, string baseurl, ImageType type, int width, int height, AspectRatio aspectRatio); public HtmlToPdfResult Convert(string url, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password); public Image ConvertToImage(string url, ImageType type); public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type); public Image ConvertToImage(string url, ImageType type, int width); public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width); public Image ConvertToImage(string url, ImageType type, int width, int height); public Image ConvertToImage(string url, ImageType type, string username, string password); public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width, int height); public Image ConvertToImage(string url, ImageType type, int width, int height, AspectRatio aspectRatio); public Image ConvertToImage(string url, ImageType type, int width, string username, string password); public Image ConvertToImage(Stream stream, Encoding encoding, ImageType type, int width, int height, AspectRatio aspectRatio); public Image ConvertToImage(string url, ImageType type, int width, int height, string username, string password); public Image ConvertToImage(string url, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password); [DispId(-5512)] public int CustomizeDownload(); protected override void Dispose(bool disposing); public Image FromString(string html, ImageType type, int width); public Image FromString(string html, string baseUrl, ImageType type); public Image FromString(string html, ImageType type, int width, int height); public Image FromString(string html, string baseUrl, ImageType type, int width); public Image FromString(string html, ImageType type, int width, int height, AspectRatio aspectRatio); public Image FromString(string html, string baseUrl, ImageType type, int width, int height); public Image FromString(string html, string baseUrl, ImageType type, int width, int height, AspectRatio aspectRatio); public Image FromString(string html, string baseUrl, ImageType type, int width, int height, AspectRatio aspectRatio, string username, string password); public Image[] GetImagesFromString(string html, string baseUrl, ImageType type); public int QueryService(ref Guid guidService, ref Guid riid, out IntPtr ppvObject);int sprẏ.GetSecurityId(string pwszUrl, IntPtr pbSecurityId, ref uint pcbSecurityId, ref uint dwReserved); int sprẏ.GetSecuritySite(out IntPtr pSite); int sprẏ.GetZoneMappings(uint dwZone, out IEnumString ppenumString, uint dwFlags); int sprẏ.MapUrlToZone(string pwszUrl, out uint pdwZone, uint dwFlags); int sprẏ.ProcessUrlAction(string pwszUrl, uint dwAction, IntPtr pPolicy, uint cbPolicy, IntPtr pContext, uint cbContext, uint dwFlags, uint dwReserved); int sprẏ.QueryCustomPolicy(string pwszUrl, ref Guid guidKey, out IntPtr ppPolicy, out uint pcbPolicy, IntPtr pContext, uint cbContext, uint dwReserved); int sprẏ.SetSecuritySite(IntPtr pSite); int sprẏ.SetZoneMapping(uint dwZone, string lpszPattern, uint dwFlags); int sprᶪ.GetContainer(object ppContainer); int sprᶪ.GetMoniker(uint dwAssign, uint dwWhichMoniker, object ppmk); int sprᶪ.OnShowWindow(bool fShow); int sprᶪ.RequestNewObjectLayout(); int sprᶪ.SaveObject(); int sprᶪ.ShowObject();

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjyydj.html