internal override void            pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
        {
            writer.WriteDictionaryBegin();
            {
                writer.WriteName("Type");
                writer.WriteName("XObject");

                writer.WriteName("Subtype");
                writer.WriteName("Image");

                writer.WriteName("Width");
                writer.WriteInteger(_width);

                writer.WriteName("Height");
                writer.WriteInteger(_height);

                writer.WriteName("ColorSpace");
                writer.WriteName("DeviceRGB");

                writer.WriteName("BitsPerComponent");
                writer.WriteInteger(_bitsPerComponent);

                writer.WriteName("Filter");
                writer.WriteName("DCTDecode");

                writer.WriteName("Interpolate");
                writer.WriteBoolean(true);

                writer.WriteName("Length");
                writer.WriteInteger(_imageDataLength);
            }
            writer.WriteDictionaryEnd();
            writer.WriteStream(_imageData, _imageDataLength);
        }
Example #2
0
        internal override void                pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
        {
            writer.WriteDictionaryBegin();

            if (_title != null)
            {
                writer.WriteName("Title");          writer.WriteString(_title);
            }
            if (_author != null)
            {
                writer.WriteName("Author");         writer.WriteString(_author);
            }
            if (_subject != null)
            {
                writer.WriteName("Subject");        writer.WriteString(_subject);
            }
            if (_keywords != null)
            {
                writer.WriteName("Keywords");       writer.WriteString(_keywords);
            }
            if (_creator != null)
            {
                writer.WriteName("Creator");        writer.WriteString(_creator);
            }
            if (_producer != null)
            {
                writer.WriteName("Producer");       writer.WriteString(_producer);
            }
            { writer.WriteName("CreationDate");   writer.WriteDate(_creationDate); }
            { writer.WriteName("ModDate");        writer.WriteDate(_modDate); }

            writer.WriteDictionaryEnd();
        }
        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();
        }
        internal override void                pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
        {
            writer.WriteDictionaryBegin();
            writer.WriteName("Type");
            writer.WriteName("Catalog");

            if (_pages != null)
            {
                writer.WriteName("Pages");
                writer.WriteReference(document, _pages);
            }

            writer.WriteName("ViewerPreferences");
            writer.WriteDictionaryBegin();
            writer.WriteName("PrintScaling");
            writer.WriteName("None");
            writer.WriteDictionaryEnd();

            writer.WriteName("PageLayout");
            writer.WriteName("SinglePage");

            writer.WriteDictionaryEnd();
        }
Example #5
0
        private void                                _writeContent(PdfStreamWriter writer, string filter, StreamBuffer buffer)
        {
            writer.WriteDictionaryBegin();

            if (filter != null)
            {
                writer.WriteName("Filter");
                writer.WriteName(filter);
            }

            writer.WriteName("Length");
            writer.WriteInteger((int)buffer.Length);
            writer.WriteDictionaryEnd();
            writer.WriteStream(buffer.GetBuffer(), (int)buffer.Length);
            _dataStream.Dispose();
            _dataStream = null; // Release datastream for less memory usage
        }
Example #6
0
        internal override void                pdfWriteToDocument(PdfDocumentWriter Document, PdfStreamWriter Writer)
        {
            Writer.WriteDictionaryBegin();
            {
                Writer.WriteName("Type");
                Writer.WriteName("Font");

                Writer.WriteName("Subtype");
                Writer.WriteName("Type1");

                Writer.WriteName("BaseFont");
                Writer.WriteName(FontName);

                Writer.WriteName("Encoding");
                Writer.WriteName("WinAnsiEncoding");
            }
            Writer.WriteDictionaryEnd();
        }
Example #7
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);
        }
        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();
        }
 internal override void                    pdfWriteToDocument(PdfDocumentWriter document, PdfStreamWriter writer)
 {
     writer.WriteDictionaryBegin();
     _children.pdfWriteToDocument(document, writer);
     writer.WriteDictionaryEnd();
 }