Esempio n. 1
0
 public PdfStream()
 {
     streamDictionary = new PdfDictionary();
     memStream = new MemoryStream();
     s = new StreamWriter(memStream);
     streamDictionary.Add(length, new PdfInt(0));
 }
Esempio n. 2
0
        private void WriteDocumentOutput(Stream stream)
        {
            StreamWriter s = new StreamWriter(stream);
            StringBuilder sb = new StringBuilder();
            StringBuilder refTable = new StringBuilder();
            int refCount = 1;
            int refStart = 0;

            // Write Header
            s.Write(header.Write());

            // Write out main content and prep the reference table
            foreach(PdfObject o in PdfDocument.registeredObject) {
                // Reference entry
                refTable.Append(sb.Length.ToString("0000000000"));
                refTable.Append(" ");
                refTable.Append(o.IndirectReference.Generation.ToString("00000"));
                refTable.Append(" n\n");
                refCount++;

                o.Write(s);
                s.Write("\n");
            }

            refStart = sb.Length;						// Get start location of the reference table

            // Write out the reference table
            s.Write("xref\n");
            s.Write(0);
            s.Write(" ");
            s.Write(refCount);
            s.Write("\n");
            s.Write("0000000000 65535 f\n");
            s.Write(refTable.ToString());

            // Write out the trailer
            s.Write("trailer\n");
            PdfDictionary trailerDic = new PdfDictionary();
            trailerDic.Add(new PdfName("Size"), new PdfInt(refCount));
            trailerDic.Add(new PdfName("Root"), catalog.IndirectReference);
            trailerDic.Write(s);
            s.Write("\nstartxref\n");
            s.Write(refStart);
            s.Write("\n%%EOF");
            s.Flush();
        }
Esempio n. 3
0
 public PdfDictionaryEnumerator(PdfDictionary dictionary)
 {
     this.dictionary = dictionary;
     this.startVersion = dictionary.version;
 }