This is an Element that contains some meta information about the document.
An object of type Meta can not be constructed by the user. Userdefined meta information should be placed in a Header-object. Meta is reserved for: Subject, Keywords, Author, Title, Producer and Creationdate information.
Inheritance: IElement
コード例 #1
0
ファイル: RtfInfoElement.cs プロジェクト: hjgode/iTextSharpCF
 /**
 * Constructs a RtfInfoElement based on the given Meta object
 *
 * @param doc The RtfDocument this RtfInfoElement belongs to
 * @param meta The Meta object this RtfInfoElement is based on
 */
 public RtfInfoElement(RtfDocument doc, Meta meta)
     : base(doc)
 {
     infoType = meta.Type;
     content = meta.Content;
 }
コード例 #2
0
ファイル: HtmlWriter.cs プロジェクト: hjgode/iTextSharpCF
 /**
  * Writes a Metatag in the header.
  *
  * @param   meta   the element that has to be written
  * @throws  IOException
  */
 protected void WriteHeader(Meta meta)
 {
     AddTabs(2);
     WriteStart(HtmlTags.META);
     switch (meta.Type) {
         case Element.HEADER:
             Write(HtmlTags.NAME, ((Header) meta).Name);
             break;
         case Element.SUBJECT:
             Write(HtmlTags.NAME, HtmlTags.SUBJECT);
             break;
         case Element.KEYWORDS:
             Write(HtmlTags.NAME, HtmlTags.KEYWORDS);
             break;
         case Element.AUTHOR:
             Write(HtmlTags.NAME, HtmlTags.AUTHOR);
             break;
     }
     Write(HtmlTags.CONTENT, HtmlEncoder.Encode(meta.Content));
     WriteEnd();
 }
コード例 #3
0
ファイル: Meta.cs プロジェクト: thenotandy/DNNspot.Store
 /// <summary>
 /// Constructs a Meta.
 /// </summary>
 /// <param name="tag">the tagname of the meta-information</param>
 /// <param name="content">the content</param>
 public Meta(string tag, string content)
 {
     this.type    = Meta.GetType(tag);
     this.content = new StringBuilder(content);
 }
コード例 #4
0
 /* (non-Javadoc)
 * @see com.lowagie.text.rtf.direct.RtfDestination#handleGroupEnd()
 */
 public override bool HandleCloseGroup() {
     if (this.text.Length > 0) {       
         Document doc = this.rtfParser.GetDocument();
         if (doc != null) {
             if (this.elementName.Equals("author")){
                 doc.AddAuthor(this.text);
             }
             if (this.elementName.Equals("title")){
                 doc.AddTitle(this.text);
             }
             if (this.elementName.Equals("subject")){
                 doc.AddSubject(this.text);
             }
         } else {
             RtfDocument rtfDoc = this.rtfParser.GetRtfDocument();
             if (rtfDoc != null) {
                 if (this.elementName.Equals("author")){
                     Meta meta = new Meta(this.elementName, this.text);
                     RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
                     rtfDoc.GetDocumentHeader().AddInfoElement(elem);
                 }
                 if (this.elementName.Equals("title")){
                     Meta meta = new Meta(this.elementName, this.text);
                     RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
                     rtfDoc.GetDocumentHeader().AddInfoElement(elem);
                 }
                 if (this.elementName.Equals("subject")){
                     Meta meta = new Meta(this.elementName, this.text);
                     RtfInfoElement elem = new RtfInfoElement(rtfDoc, meta);
                     rtfDoc.GetDocumentHeader().AddInfoElement(elem);
                 }
             }
         }
         this.SetToDefaults();
     }
     return true;
 }
コード例 #5
0
ファイル: RtfWriter.cs プロジェクト: hjgode/iTextSharpCF
 /**
 * Add a <code>Meta</code> element. It is written to the Inforamtion Group
 * and merged with the main <code>MemoryStream</code> when the
 * Document is closed.
 *
 * @param metaName The type of <code>Meta</code> element to be added
 * @param meta The <code>Meta</code> element to be added
 *
 * Currently only the Meta Elements Author, Subject, Keywords, Title, Producer and CreationDate are supported.
 *
 * @throws IOException
 */
 private void WriteMeta(byte[] metaName, Meta meta)
 {
     info.WriteByte(openGroup);
     try {
         info.WriteByte(escape);
         info.Write(metaName, 0, metaName.Length);
         info.WriteByte(delimiter);
         if (meta.Type == Element.CREATIONDATE) {
             WriteFormatedDateTime(meta.Content);
         } else {
             byte[] t = DocWriter.GetISOBytes(meta.Content);
             info.Write(t, 0, t.Length);
         }
     } finally {
         info.WriteByte(closeGroup);
     }
 }