本文整理汇总了C#中IElement.Process方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.Process方法的具体用法?C# IElement.Process怎么用?C# IElement.Process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IElement
的用法示例。
在下文中一共展示了IElement.Process方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
/**
* Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
*
* @param element the element to add
* @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
* @throws DocumentException when a document isn't open yet, or has been closed
*/
public override bool Add(IElement element) {
if (writer != null && writer.IsPaused()) {
return false;
}
if (element.Type != Element.DIV) {
FlushFloatingElements();
}
switch (element.Type) {
// Information (headers)
case Element.HEADER:
info.Addkey(((Meta)element).Name, ((Meta)element).Content);
break;
case Element.TITLE:
info.AddTitle(((Meta)element).Content);
break;
case Element.SUBJECT:
info.AddSubject(((Meta)element).Content);
break;
case Element.KEYWORDS:
info.AddKeywords(((Meta)element).Content);
break;
case Element.AUTHOR:
info.AddAuthor(((Meta)element).Content);
break;
case Element.CREATOR:
info.AddCreator(((Meta)element).Content);
break;
case Element.LANGUAGE:
SetLanguage(((Meta)element).Content);
break;
case Element.PRODUCER:
// you can not change the name of the producer
info.AddProducer();
break;
case Element.CREATIONDATE:
// you can not set the creation date, only reset it
info.AddCreationDate();
break;
// content (text)
case Element.CHUNK: {
// if there isn't a current line available, we make one
if (line == null) {
CarriageReturn();
}
// we cast the element to a chunk
PdfChunk chunk = new PdfChunk((Chunk) element, anchorAction, tabSettings);
// we try to add the chunk to the line, until we succeed
{
PdfChunk overflow;
while ((overflow = line.Add(chunk)) != null) {
CarriageReturn();
bool newlineSplit = chunk.IsNewlineSplit();
chunk = overflow;
if (!newlineSplit)
chunk.TrimFirstSpace();
}
}
pageEmpty = false;
if (chunk.IsAttribute(Chunk.NEWPAGE)) {
NewPage();
}
break;
}
case Element.ANCHOR: {
Anchor anchor = (Anchor) element;
String url = anchor.Reference;
leading = anchor.Leading;
PushLeading();
if (url != null) {
anchorAction = new PdfAction(url);
}
// we process the element
element.Process(this);
anchorAction = null;
PopLeading();
break;
}
case Element.ANNOTATION: {
if (line == null) {
CarriageReturn();
}
Annotation annot = (Annotation) element;
Rectangle rect = new Rectangle(0, 0);
if (line != null)
rect = new Rectangle(annot.GetLlx(IndentRight - line.WidthLeft), annot.GetUry(IndentTop - currentHeight - 20), annot.GetUrx(IndentRight - line.WidthLeft + 20), annot.GetLly(IndentTop - currentHeight));
PdfAnnotation an = PdfAnnotationsImp.ConvertAnnotation(writer, annot, rect);
annotationsImp.AddPlainAnnotation(an);
pageEmpty = false;
break;
//.........这里部分代码省略.........
示例2: Add
/**
* Signals that an <CODE>Element</CODE> was added to the <CODE>Document</CODE>.
*
* @param element the element to add
* @return <CODE>true</CODE> if the element was added, <CODE>false</CODE> if not.
* @throws DocumentException when a document isn't open yet, or has been closed
*/
public override bool Add(IElement element)
{
if (writer != null && writer.IsPaused()) {
return false;
}
switch (element.Type) {
// Information (headers)
case Element.HEADER:
info.Addkey(((Meta)element).Name, ((Meta)element).Content);
break;
case Element.TITLE:
info.AddTitle(((Meta)element).Content);
break;
case Element.SUBJECT:
info.AddSubject(((Meta)element).Content);
break;
case Element.KEYWORDS:
info.AddKeywords(((Meta)element).Content);
break;
case Element.AUTHOR:
info.AddAuthor(((Meta)element).Content);
break;
case Element.CREATOR:
info.AddCreator(((Meta)element).Content);
break;
case Element.PRODUCER:
// you can not change the name of the producer
info.AddProducer();
break;
case Element.CREATIONDATE:
// you can not set the creation date, only reset it
info.AddCreationDate();
break;
// content (text)
case Element.CHUNK: {
// if there isn't a current line available, we make one
if (line == null) {
CarriageReturn();
}
// we cast the element to a chunk
PdfChunk chunk = new PdfChunk((Chunk) element, anchorAction);
// we try to add the chunk to the line, until we succeed
{
PdfChunk overflow;
while ((overflow = line.Add(chunk)) != null) {
CarriageReturn();
chunk = overflow;
chunk.TrimFirstSpace();
}
}
pageEmpty = false;
if (chunk.IsAttribute(Chunk.NEWPAGE)) {
NewPage();
}
break;
}
case Element.ANCHOR: {
Anchor anchor = (Anchor) element;
String url = anchor.Reference;
leading = anchor.Leading;
if (url != null) {
anchorAction = new PdfAction(url);
}
// we process the element
element.Process(this);
anchorAction = null;
break;
}
case Element.ANNOTATION: {
if (line == null) {
CarriageReturn();
}
Annotation annot = (Annotation) element;
Rectangle rect = new Rectangle(0, 0);
if (line != null)
rect = new Rectangle(annot.GetLlx(IndentRight - line.WidthLeft), annot.GetLly(IndentTop - currentHeight), annot.GetUrx(IndentRight - line.WidthLeft + 20), annot.GetUry(IndentTop - currentHeight - 20));
PdfAnnotation an = PdfAnnotationsImp.ConvertAnnotation(writer, annot, rect);
annotationsImp.AddPlainAnnotation(an);
pageEmpty = false;
break;
}
case Element.PHRASE: {
// we cast the element to a phrase and set the leading of the document
leading = ((Phrase) element).Leading;
// we process the element
element.Process(this);
break;
}
case Element.PARAGRAPH: {
//.........这里部分代码省略.........