当前位置: 首页>>代码示例>>C#>>正文


C# IDocListener类代码示例

本文整理汇总了C#中IDocListener的典型用法代码示例。如果您正苦于以下问题:C# IDocListener类的具体用法?C# IDocListener怎么用?C# IDocListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IDocListener类属于命名空间,在下文中一共展示了IDocListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetImage

        /// <summary>
        /// The get image.
        /// </summary>
        /// <param name="src">The src.</param>
        /// <param name="attrs">The attrs.</param>
        /// <param name="chain">The chain.</param>
        /// <param name="doc">The doc.</param>
        /// <returns>
        /// The <see cref="Image" />.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">src</exception>
        /// <exception cref="ArgumentNullException">src</exception>
        public Image GetImage(string src, IDictionary<string, string> attrs, ChainedProperties chain, IDocListener doc)
        {
            if (string.IsNullOrWhiteSpace(src))
            {
                return null;
            }

            if (src.StartsWith("http", StringComparison.OrdinalIgnoreCase))
            {
                return this.GetImage(src);
            }

            if (HostingEnvironment.VirtualPathProvider.FileExists(src))
            {
                try
                {
                    UnifiedFile unifiedFile = HostingEnvironment.VirtualPathProvider.GetFile(src) as UnifiedFile;
                    return unifiedFile == null ? null : this.GetImage(unifiedFile.LocalPath);
                }
                catch (Exception exception)
                {
                    Logger.ErrorFormat(CultureInfo.InvariantCulture, "[OutputFormats] File not found for:'{0}'. \n {1}", src, exception);
                    return null;
                }
            }

            string baseurl = Settings.Instance.SiteUrl.GetLeftPart(UriPartial.Authority);
            src = string.Format(CultureInfo.InvariantCulture, "{0}{1}", baseurl, src);

            return this.GetImage(src);
        }
开发者ID:jstemerdink,项目名称:EPiServer.Libraries,代码行数:43,代码来源:ImageProvider.cs

示例2: GetImage

 public Image GetImage(String src, IDictionary<string,string> h, 
   ChainedProperties cprops, IDocListener doc)
 {
   return Image.GetInstance(Path.Combine(
     Utility.ResourcePosters,
     src.Substring(src.LastIndexOf("/") + 1)
   ));
 }    
开发者ID:kuujinbo,项目名称:iTextInAction2Ed,代码行数:8,代码来源:HtmlMovies2.cs

示例3: GetImage

            // alias: using iTextImage = iTextSharp.text.Image;
            public iTextImage GetImage(string src,
                IDictionary<string, string> attrs,
                ChainedProperties chain,
                IDocListener doc)
            {
                Match match;
                // [1]
                if ((match = Base64.Match(src)).Length > 0)
                {
                    return iTextImage.GetInstance(
                        Convert.FromBase64String(match.Groups["data"].Value)
                    );
                }

                // [2]
                if (!src.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                {
                    src = HttpContext.Current.Server.MapPath(
                        new Uri(new Uri(BaseUri), src).AbsolutePath
                    ); 
                }
                return iTextImage.GetInstance(src);
            }
开发者ID:kuujinbo,项目名称:StackOverflow.iTextSharp.MVC,代码行数:24,代码来源:HtmlImageHandler.aspx.cs

示例4: Go

 /// <summary>
 /// Parses a given file.
 /// </summary>
 /// <param name="document"></param>
 /// <param name="file"></param>
 /// <param name="tagmap"></param>
 public override void Go(IDocListener document, String file, String tagmap)
 {
     parser = new ITextmyHtmlHandler(document, new TagMap(tagmap));
     parser.Parse(file);
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:11,代码来源:HtmlParser.cs

示例5: ITextHandler

 /**
 * @param document
 * @param myTags
 * @throws DocumentException
 * @throws IOException
 */
 public ITextHandler(IDocListener document, Hashtable myTags) : this(document) {
     this.myTags = myTags;
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:9,代码来源:ITextHandler.cs

示例6: HTMLWorker

 /**
  * Creates a new instance of HTMLWorker
  * @param document A class that implements <CODE>DocListener</CODE>
  */
 public HTMLWorker(IDocListener document) : this(document, null, null) {
 }
开发者ID:jagruti23,项目名称:itextsharp,代码行数:6,代码来源:HTMLWorker.cs

示例7: CreateImage

 public Image CreateImage(
         String src,
         IDictionary<String, String> attrs,
         ChainedProperties chain,
         IDocListener document,
         IImageProvider img_provider,
         Dictionary<String, Image> img_store,
         String img_baseurl) {
     Image img = null;
     // getting the image using an image provider
     if (img_provider != null)
         img = img_provider.GetImage(src, attrs, chain, document);
     // getting the image from an image store
     if (img == null && img_store != null) {
         Image tim;
         img_store.TryGetValue(src, out tim);
         if (tim != null)
             img = Image.GetInstance(tim);
     }
     if (img != null)
         return img;
     // introducing a base url
     // relative src references only
     if (!src.StartsWith("http") && img_baseurl != null) {
         src = img_baseurl + src;
     }
     else if (img == null && !src.StartsWith("http")) {
         String path = chain[HtmlTags.IMAGEPATH];
         if (path == null)
             path = "";
         src = Path.Combine(path, src);
     }
     img = Image.GetInstance(src);
     if (img == null)
         return null;
     
     float actualFontSize = HtmlUtilities.ParseLength(
         chain[HtmlTags.SIZE],
         HtmlUtilities.DEFAULT_FONT_SIZE);
     if (actualFontSize <= 0f)
         actualFontSize = HtmlUtilities.DEFAULT_FONT_SIZE;
     String width;
     attrs.TryGetValue(HtmlTags.WIDTH, out width);
     float widthInPoints = HtmlUtilities.ParseLength(width, actualFontSize);
     String height;
     attrs.TryGetValue(HtmlTags.HEIGHT, out height);
     float heightInPoints = HtmlUtilities.ParseLength(height, actualFontSize);
     if (widthInPoints > 0 && heightInPoints > 0) {
         img.ScaleAbsolute(widthInPoints, heightInPoints);
     } else if (widthInPoints > 0) {
         heightInPoints = img.Height * widthInPoints
                 / img.Width;
         img.ScaleAbsolute(widthInPoints, heightInPoints);
     } else if (heightInPoints > 0) {
         widthInPoints = img.Width * heightInPoints
                 / img.Height;
         img.ScaleAbsolute(widthInPoints, heightInPoints);
     }
     
     String before = chain[HtmlTags.BEFORE];
     if (before != null)
         img.SpacingBefore = float.Parse(before, CultureInfo.InvariantCulture);
     String after = chain[HtmlTags.AFTER];
     if (after != null)
         img.SpacingAfter = float.Parse(after, CultureInfo.InvariantCulture);
     img.WidthPercentage = 0;
     return img;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:68,代码来源:ElementFactory.cs

示例8: Parse

 /// <summary>
 /// Parses a given file.
 /// </summary>
 /// <param name="document"></param>
 /// <param name="file"></param>
 public static new void Parse(IDocListener document, XmlDocument xDoc)
 {
     HtmlParser p = new HtmlParser();
     p.Go(document, xDoc);
 }
开发者ID:bmictech,项目名称:iTextSharp,代码行数:10,代码来源:HtmlParser.cs

示例9: AddDocListener

 // listener methods
 /// <summary>
 /// Adds a IDocListener to the Document.
 /// </summary>
 /// <param name="listener">the new IDocListener</param>
 public void AddDocListener(IDocListener listener)
 {
     listeners.Add(listener);
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:9,代码来源:Document.cs

示例10: WriteTableModels

        /// <summary>
        /// Write all data splitted in slices to the specified writer
        /// </summary>
        /// <param name="model">
        /// The dataset model
        /// </param>
        /// <param name="doc">
        /// The PDF document
        /// </param>
        private void WriteTableModels(IDataSetModel model, IDocListener doc)
        {
            IDataReader reader = model.GetReader(false);

            // DIV containerTable = createContainerTable();
            string oldKeySet = null;
            var s = new RendererState(model);

            while (reader.Read())
            {
                s.InputRow = reader;
                string currentKeySet = MakeKey(model.SliceKeys, reader);

                if (!currentKeySet.Equals(oldKeySet))
                {
                    oldKeySet = currentKeySet;
                    CommitTable(s, doc);

                    // containerTable = createContainerTable();
                    this.CreateSliceHeader(doc, s);

                    // addSliceHeading(containerTable, sTable);
                    s.Table = CreateSliceTable();

                    // addSliceTable(containerTable, s.table);
                    this.InitTitles(s);
                }

                this.ParseDataRow(s);
            }

            reader.Close();
            s.InputRow = null;
            CommitTable(s, doc);
        }
开发者ID:alcardac,项目名称:SDMX_DATA_BROWSER,代码行数:44,代码来源:PdfRenderer.cs

示例11: CommitTable

        /// <summary>
        /// Commit the current table and reset state
        /// </summary>
        /// <param name="state">
        /// The state
        /// </param>
        /// <param name="doc">
        /// The pdf document to commit the current table
        /// </param>
        private static void CommitTable(RendererState state, IDocListener doc)
        {
            if (state.Table != null)
            {
                PopulateTable(state);

                // containerTable.Write(writer);
                PdfPTable table = CreatePdf(state.Table);
                if (table != null)
                {
                    doc.Add(table);
                    table.DeleteBodyRows();
                }

                doc.NewPage();
                state.Reset();
            }
        }
开发者ID:alcardac,项目名称:SDMX_DATA_BROWSER,代码行数:27,代码来源:PdfRenderer.cs

示例12: ITextmyHtmlHandler

 public ITextmyHtmlHandler(IDocListener document, BaseFont bf)
     : base(document, new HtmlTagMap(), bf)
 {
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:4,代码来源:ITextmyHtmlHandler.cs

示例13: HTMLWorker

 /** Creates a new instance of HTMLWorker */
 public HTMLWorker(IDocListener document) {
     this.document = document;
 }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:4,代码来源:HTMLWorker.cs

示例14: AddDocListener

        // listener methods

        /// <summary>
        /// Adds a IDocListener to the Document.
        /// </summary>
        /// <param name="listener">the new IDocListener</param>
        virtual public void AddDocListener(IDocListener listener) {
            listeners.Add(listener);
            if (listener is IAccessibleElement) {
                IAccessibleElement ae = (IAccessibleElement)listener;
                ae.Role = this.role;
                ae.ID = this.id;
                if (this.accessibleAttributes != null) {
                    foreach (PdfName key in this.accessibleAttributes.Keys)
                        ae.SetAccessibleAttribute(key, this.accessibleAttributes[key]);
                }
            }
        }
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:18,代码来源:Document.cs

示例15: RemoveIDocListener

 /// <summary>
 /// Removes a IDocListener from the Document.
 /// </summary>
 /// <param name="listener">the IDocListener that has to be removed.</param>
 public void RemoveIDocListener(IDocListener listener)
 {
     listeners.Remove(listener);
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:8,代码来源:Document.cs


注:本文中的IDocListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。