Пример #1
0
        internal override void                    pdfWriteToDocument(PdfDocumentWriter Document, PdfStreamWriter Writer)
        {
            Writer.WriteDictionaryBegin();

            Writer.WriteName("Type");
            Writer.WriteName("Pages");

            if (Parent != null)
            {
                Writer.WriteName("Parent");
                Writer.WriteReference(Document, Parent);
            }

            Writer.WriteName("Count");
            Writer.WriteInteger(_count);

            Writer.WriteName("Kids");
            Writer.WriteArrayBegin();

            for (int i = 0; i < _pages.Count; ++i)
            {
                Writer.WriteReference(Document, _pages[i]);
            }

            Writer.WriteArrayEnd();

            Writer.WriteDictionaryEnd();
        }
Пример #2
0
        private void                    _writeTrailer14()
        {
            // Write xref table
            int posXrefTable = _writer.PdfPosition;

            _writer.WriteXrefHeader(_xrefTable.Count);

            {
                int    v;
                int    p;
                byte[] buf = new byte[20];

                for (int ObjectID = 0; ObjectID < _xrefTable.Count; ++ObjectID)
                {
                    PdfWriterReference entry = _xrefTable[ObjectID];

                    v = (entry != null) ? entry.Position : 0;
                    for (p = 0; p < 10; ++p)
                    {
                        buf[9 - p] = (byte)('0' + (v % 10));
                        v         /= 10;
                    }

                    buf[10] = (byte)' ';

                    v = (entry != null) ? 0 : 65535;
                    for (p = 0; p < 5; ++p)
                    {
                        buf[15 - p] = (byte)('0' + (v % 10));
                        v          /= 10;
                    }

                    buf[16] = (byte)' ';
                    buf[17] = (byte)((entry != null) ? 'n' : 'f');
                    buf[18] = (byte)' ';
                    buf[19] = (byte)'\n';

                    _writer.WriteByteArray(buf, 0, 20);
                }
            }

            // write trailer
            _writer.WriteTrailer();
            _writer.WriteDictionaryBegin();
            {
                // Size
                {
                    _writer.WriteName("Size");
                    _writer.WriteInteger(_xrefTable.Count);
                }

                // Root
                {
                    _writer.WriteName("Root");
                    _writer.WriteReference(GetReference(_catalog));
                }

                // Info
                {
                    _writer.WriteName("Info");
                    _writer.WriteReference(GetReference(_documentInfo));
                }

                // ID
                {
                    _writer.WriteName("ID");
                    _writer.WriteArrayBegin();
                    _writer.WriteStringHex(System.Guid.NewGuid().ToByteArray());
                    _writer.WriteStringHex(System.Guid.NewGuid().ToByteArray());
                    _writer.WriteArrayEnd();
                }
            }
            _writer.WriteDictionaryEnd();
            _writer.WriteNewLine();

            // write startxref and EOF
            _writer.WriteEOF(posXrefTable);
        }
Пример #3
0
        internal override void                    pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
        {
            writer.WriteDictionaryBegin();
            {
                writer.WriteName("Type");
                writer.WriteName("Page");

                writer.WriteName("Parent");
                writer.WriteReference(document, Parent);

                writer.WriteName("MediaBox");
                writer.WriteArrayBegin();
                {
                    writer.WriteInteger(0);
                    writer.WriteInteger(0);
                    writer.WriteNumber(_pageSize.width.pnts);
                    writer.WriteNumber(_pageSize.height.pnts);
                }
                writer.WriteArrayEnd();

                writer.WriteName("CropBox");
                writer.WriteRectangle(_cropBox);

                if (_bleedBox != _cropBox)
                {
                    writer.WriteName("BleedBox");
                    writer.WriteRectangle(_bleedBox);
                }

                if (_trimBox != _cropBox)
                {
                    writer.WriteName("TrimBox");
                    writer.WriteRectangle(_trimBox);
                }

                if (_artBox != _cropBox)
                {
                    writer.WriteName("ArtBox");
                    writer.WriteRectangle(_artBox);
                }

                writer.WriteName("Contents");
                writer.WriteArrayBegin();

                for (var curContent = this._content; curContent != null; curContent = curContent.Parent)
                {
                    writer.WriteReference(document.GetReference(curContent));
                }

                writer.WriteArrayEnd();


                writer.WriteName("Resources");
                writer.WriteDictionaryBegin();
                {
                    writer.WriteName("ProcSet");
                    writer.WriteArrayBegin();
                    {
                        writer.WriteName("PDF");
                        writer.WriteName("Text");
                        writer.WriteName("ImageB");
                        writer.WriteName("ImageC");
                    }
                    writer.WriteArrayEnd();

                    _content.Resources.pdfWriteResources(document, writer);
                }
                writer.WriteDictionaryEnd();
            }
            writer.WriteDictionaryEnd();
        }
Пример #4
0
 internal override void                    pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
 {
     writer.WriteArrayBegin();
     _children.pdfWriteToDocument(document, writer);
     writer.WriteArrayEnd();
 }