本文整理汇总了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);
}
示例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)
));
}
示例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);
}
示例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);
}
示例5: ITextHandler
/**
* @param document
* @param myTags
* @throws DocumentException
* @throws IOException
*/
public ITextHandler(IDocListener document, Hashtable myTags) : this(document) {
this.myTags = myTags;
}
示例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) {
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例12: ITextmyHtmlHandler
public ITextmyHtmlHandler(IDocListener document, BaseFont bf)
: base(document, new HtmlTagMap(), bf)
{
}
示例13: HTMLWorker
/** Creates a new instance of HTMLWorker */
public HTMLWorker(IDocListener document) {
this.document = document;
}
示例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]);
}
}
}
示例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);
}