Exemplo n.º 1
0
        protected internal override void Write(PdfWriter writer)
        {
            Debug.Assert(!IsIndirect, "An object reference cannot be indirect");

            writer.Write(refId.ObjectNumber);
            writer.WriteSpace();
            writer.Write(refId.GenerationNumber);
            writer.WriteSpace();
            writer.WriteKeyword(Keyword.R);
        }
        protected internal override void Write(PdfWriter writer)
        {
            Debug.Assert(!IsIndirect, "An object reference cannot be indirect");

            writer.Write(refId.ObjectNumber);
            writer.WriteSpace();
            writer.Write(refId.GenerationNumber);
            writer.WriteSpace();
            writer.WriteKeyword(Keyword.R);
        }
Exemplo n.º 3
0
 protected internal override void Write(PdfWriter writer)
 {
     writer.WriteKeyword(Keyword.ArrayBegin);
     writer.Write(PdfString.ToPdfHexadecimal(new byte[] { }, CreatedPart));
     writer.WriteSpace();
     writer.Write(PdfString.ToPdfHexadecimal(new byte[] { }, ModifiedPart));
     writer.WriteKeyword(Keyword.ArrayEnd);
 }
Exemplo n.º 4
0
 protected internal override void Write(PdfWriter writer)
 {
     writer.WriteKeyword(Keyword.ArrayBegin);
     writer.Write(PdfString.ToPdfHexadecimal(null, CreatedPart, writer.TempMemStream));
     writer.WriteSpace();
     writer.Write(PdfString.ToPdfHexadecimal(null, ModifiedPart, writer.TempMemStream));
     writer.WriteKeyword(Keyword.ArrayEnd);
 }
Exemplo n.º 5
0
 protected internal override void Write(PdfWriter writer)
 {
     writer.WriteKeyword(Keyword.ArrayBegin);
     writer.Write(PdfString.ToPdfHexadecimal(new byte[] { }, CreatedPart));
     writer.WriteSpace();
     writer.Write(PdfString.ToPdfHexadecimal(new byte[] { }, ModifiedPart));
     writer.WriteKeyword(Keyword.ArrayEnd);
 }
Exemplo n.º 6
0
 protected internal override void Write(PdfWriter writer)
 {
     writer.WriteKeywordLine(Keyword.DictionaryBegin);
     foreach (DictionaryEntry e in entries)
     {
         writer.Write((PdfName)e.Key);
         writer.WriteSpace();
         writer.WriteLine((PdfObject)e.Value);
     }
     writer.WriteKeyword(Keyword.DictionaryEnd);
 }
Exemplo n.º 7
0
        protected internal void WriteIndirect(PdfWriter writer)
        {
            Debug.Assert(writer != null);
            Debug.Assert(IsIndirect);

            // Write the object number and generation number
            // followed by the keyword 'obj' and finally a newline.
            writer.Write(objectId.ObjectNumber);
            writer.WriteSpace();
            writer.Write(objectId.GenerationNumber);
            writer.WriteSpace();
            writer.WriteKeywordLine(Keyword.Obj);

            // Write the objects value, subclasses will override this.
            Write(writer);

            // Follow the objects value with a newline and then the keyword 'endobj'.
            writer.WriteLine();
            writer.WriteKeyword(Keyword.EndObj);
        }
Exemplo n.º 8
0
        protected internal void WriteIndirect(PdfWriter writer)
        {
            Debug.Assert(writer != null);
            Debug.Assert(IsIndirect);

            // Write the object number and generation number 
            // followed by the keyword 'obj' and finally a newline.
            writer.Write(objectId.ObjectNumber);
            writer.WriteSpace();
            writer.Write(objectId.GenerationNumber);
            writer.WriteSpace();
            writer.WriteKeywordLine(Keyword.Obj);

            // Write the objects value, subclasses will override this.
            Write(writer);

            // Follow the objects value with a newline and then the keyword 'endobj'.
            writer.WriteLine();
            writer.WriteKeyword(Keyword.EndObj);
        }
Exemplo n.º 9
0
        /// <summary>
        ///     Writes the cross reference sub-section to the passed PDF writer.
        /// </summary>
        internal void Write(PdfWriter writer)
        {
            // The format of each cross-reference entry should occupy
            // exacty 20 ASCII bytes including the newline character.
            string entryFormat = "{0:0000000000} {1:00000} {2}";

            if (writer.NewLine.Length == 1)
            {
                // If the newline is configured as only a single character,
                // then we need to add an extra space to ensure the
                // resulting entry is always 20 bytes long.
                entryFormat += " ";
            }

            // Sort the entries.
            entries.Sort();

            // Identify the first and last entries.
            uint first = 0;
            uint last  = ((Entry)entries[entries.Count - 1]).objectId.ObjectNumber;

            // Work out the number of entries based on the first and last object numbers.
            uint count = last - first + 1;

            // Output the first object number and the number of entries.
            writer.Write(first);
            writer.WriteSpace();
            writer.WriteLine(count);

            // Output the head of the linked list of free entries.
            // Right now, this implmentation does not support free
            // entries properly, so we just output an empty list and
            // hope that only contingous entries are ever added.
            byte[] bytes = Encoding.ASCII.GetBytes(
                String.Format(entryFormat, 0, 65535, "f"));
            writer.WriteLine(bytes);

            // Output each entry.
            foreach (Entry entry in entries)
            {
                bytes = Encoding.ASCII.GetBytes(
                    String.Format(entryFormat, entry.offset,
                                  entry.objectId.GenerationNumber, "n"));
                writer.WriteLine(bytes);
            }
        }
Exemplo n.º 10
0
        protected internal override void Write(PdfWriter writer)
        {
            writer.WriteKeyword(Keyword.ArrayBegin);
            bool isFirst = true;

            foreach (PdfObject obj in elements)
            {
                if (!isFirst)
                {
                    writer.WriteSpace();
                }
                else
                {
                    isFirst = false;
                }
                writer.Write(obj);
            }
            writer.WriteKeyword(Keyword.ArrayEnd);
        }
Exemplo n.º 11
0
 public void WriteSpace()
 {
     streamData.WriteSpace();
 }
Exemplo n.º 12
0
 protected internal override void Write(PdfWriter writer)
 {
     writer.WriteKeyword(Keyword.ArrayBegin);
     bool isFirst = true;
     foreach (PdfObject obj in elements)
     {
         if (!isFirst)
         {
             writer.WriteSpace();
         }
         else
         {
             isFirst = false;
         }
         writer.Write(obj);
     }
     writer.WriteKeyword(Keyword.ArrayEnd);
 }
Exemplo n.º 13
0
        /// <summary>
        ///     Writes the cross reference sub-section to the passed PDF writer.
        /// </summary>
        internal void Write(PdfWriter writer)
        {
            // The format of each cross-reference entry should occupy
            // exacty 20 ASCII bytes including the newline character.
            string entryFormat = "{0:0000000000} {1:00000} {2}";
            if (writer.NewLine.Length == 1)
            {
                // If the newline is configured as only a single character,
                // then we need to add an extra space to ensure the
                // resulting entry is always 20 bytes long.
                entryFormat += " ";
            }

            // Sort the entries.
            entries.Sort();

            // Identify the first and last entries.
            uint first = 0;
            uint last = ((Entry)entries[entries.Count - 1]).objectId.ObjectNumber;

            // Work out the number of entries based on the first and last object numbers.
            uint count = last - first + 1;

            // Output the first object number and the number of entries.
            writer.Write(first);
            writer.WriteSpace();
            writer.WriteLine(count);

            // Output the head of the linked list of free entries.
            // Right now, this implmentation does not support free
            // entries properly, so we just output an empty list and
            // hope that only contingous entries are ever added.
            byte[] bytes = Encoding.ASCII.GetBytes(
                String.Format(entryFormat, 0, 65535, "f"));
            writer.WriteLine(bytes);

            // Output each entry.
            foreach (Entry entry in entries)
            {
                bytes = Encoding.ASCII.GetBytes(
                    String.Format(entryFormat, entry.offset,
                                  entry.objectId.GenerationNumber, "n"));
                writer.WriteLine(bytes);
            }
        }