Exemplo n.º 1
0
        /**
         * Writes the RTF information group and its elements.
         */
        public override void WriteContent(Stream result)
        {
            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(INFO_GROUP, 0, INFO_GROUP.Length);
            for (int i = 0; i < infoElements.Count; i++)
            {
                RtfInfoElement infoElement = (RtfInfoElement)infoElements[i];
                infoElement.WriteContent(result);
            }

            // handle document protection
            if (document.GetDocumentSettings().IsDocumentProtected())
            {
                byte[] t;
                result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
                result.Write(INFO_PASSWORD, 0, INFO_PASSWORD.Length);
                result.Write(DELIMITER, 0, DELIMITER.Length);
                result.Write(t = document.GetDocumentSettings().GetProtectionHashBytes(), 0, t.Length);
                result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            }
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);
        }
Exemplo n.º 2
0
 /**
  * Adds an RtfInfoElement to the RtfInfoGroup
  *
  * @param infoElement The RtfInfoElement to add
  */
 public void Add(RtfInfoElement infoElement)
 {
     this.infoElements.Add(infoElement);
 }
Exemplo n.º 3
0
 /* (non-Javadoc)
 * @see com.lowagie.text.rtf.direct.RtfDestination#handleGroupEnd()
 */
 public override bool HandleCloseGroup()
 {
     if (this.text.Length > 0) {
         var 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;
 }
Exemplo n.º 4
0
 /**
  * Adds an RtfInfoElement to the list of RtfInfoElements
  *
  * @param rtfInfoElement The RtfInfoElement to add
  */
 public void AddInfoElement(RtfInfoElement rtfInfoElement)
 {
     this.infoGroup.Add(rtfInfoElement);
 }
Exemplo n.º 5
0
 /**
 * Adds an RtfInfoElement to the list of RtfInfoElements
 *
 * @param rtfInfoElement The RtfInfoElement to add
 */
 public void AddInfoElement(RtfInfoElement rtfInfoElement)
 {
     this.infoGroup.Add(rtfInfoElement);
 }
Exemplo n.º 6
0
 /**
 * Adds an RtfInfoElement to the RtfInfoGroup
 *
 * @param infoElement The RtfInfoElement to add
 */
 public void Add(RtfInfoElement infoElement)
 {
     this.infoElements.Add(infoElement);
 }