public void writeObject(PDFWriter out)

        {
            int length = 0;

            for (TempBuffer ptr = _jpegHead; ptr != null; ptr = ptr.getNext())
            {
                length += ptr.getLength();
            }

            @out.println("<< /Type /XObject");
            @out.println("   /Subtype /Image");
            @out.println("   /Width " + _width);
            @out.println("   /Height " + _height);
            @out.println("   /ColorSpace /DeviceRGB");
            @out.println("   /BitsPerComponent " + _bits);
            @out.println("   /Filter /DCTDecode");
            @out.println("   /Length " + length);
            @out.println(">>");
            @out.println("stream");

            for (TempBuffer ptr = _jpegHead; ptr != null; ptr = ptr.getNext())
            {
                @out.write(ptr.getBuffer(), 0, ptr.getLength());
            }
            @out.println();
            @out.println("endstream");
        }
Exemple #2
0
        /**
         * Writes the object to the stream
         */
        public void writeObject(PDFWriter out)

        {
            long length = _path.getLength();

            @out.println("<< /Type /EmbeddedFile");
            @out.println("   /Length " + length);
            @out.println(">>");
            @out.println("stream");

            TempBuffer tb = TempBuffer.allocate();

            byte [] buffer = tb.getBuffer();
            int     sublen;

            InputStream @is = _path.openRead();

            while ((sublen = @is.read(buffer, 0, buffer.length)) > 0)
            {
                @out.write(buffer, 0, sublen);
            }

            @out.println();
            @out.println("endstream");
        }
        /**
         * Writes the object to the stream
         */
        public void writeObjectNew(PDFWriter out)

        {
            long length = _path.getLength();

            @out.println("<< /Type /XObject");
            @out.println("   /Subtype /Image");
            @out.println("   /Width " + _width);
            @out.println("   /Height " + _height);
            @out.println("   /ColorSpace /DeviceRGB");
            @out.println("   /BitsPerComponent " + _bits);
            // @out.println("   /Filter /DCTDecode");
            @out.println("   /Length " + length);
            @out.println(">>");
            @out.println("stream");

            TempBuffer tb = TempBuffer.allocate();

            byte [] buffer = tb.getBuffer();
            int     sublen;

            InputStream @is = _path.openRead();

            while ((sublen = @is.read(buffer, 0, buffer.length)) > 0)
            {
                @out.write(buffer, 0, sublen);
            }

            @out.println();
            @out.println("endstream");
        }
Exemple #4
0
 PDFPage(PDFWriter @out, int parent, double width, double height)
 {
     _parent = parent;
     _id     = @out.allocateId(1);
     _width  = width;
     _height = height;
     _stream = new PDFStream(@out.allocateId(1));
 }
Exemple #5
0
        public override void writeObject(PDFWriter out)

        {
            @out.println("<< /Type /Font");
            @out.println("   /Subtype /Type1");
            @out.println("   /BaseFont /" + _face.getFontName());
            @out.println("   /Encoding /MacRomanEncoding");
            @out.println(">>");
        }
        /**
         * Writes the object to the stream
         */
        public override void writeObject(PDFWriter out)

        {
            @out.println("<< /Type /XObject");
            @out.println("   /Subtype /Image");
            @out.println("   /BitsPerComponent 8");
            @out.println("   /ColorSpace /DeviceRGB");
            @out.println("   /Width " + _width);
            @out.println("   /Height " + _height);
            @out.println("   /F " + _refId + " 0 R");
            @out.println("   /Length " + 0);
            @out.println(">>");
            @out.println("stream");
            @out.println("endstream");
        }
        public bool begin_document(@Optional string fileName,
                                   @Optional string optList)

        {
            _tempStream = new TempStream();
            _tempStream.openWrite();
            _os = new WriteStream(_tempStream);

            _out = new PDFWriter(_os);
            _out.beginDocument();

            _catalogId    = _out.allocateId(1);
            _rootId       = _out.allocateId(1);
            _pageParentId = _out.allocateId(1);

            return(true);
        }
Exemple #8
0
        void write(PDFWriter out)

        {
            @out.beginObject(_id);
            @out.println("  << /Type /Page");
            @out.println("     /Parent " + _parent + " 0 R");
            @out.println("     /MediaBox [0 0 " + _width + " " + _height + "]");
            @out.println("     /Contents " + _stream.getId() + " 0 R");
            @out.println("     /Resources <<");

            for (Map.Entry <String, String> entry : _resources.entrySet())
            {
                @out.println("     " + entry.getKey() + " " + entry.getValue());
            }

            @out.println("     >>");
            @out.println("  >>");
            @out.endObject();

            _stream.write(out);
        }
        public void write(PDFWriter out)

        {
            @out.writeStream(getId(), this);
        }
 /**
  * Writes the object to the stream
  */
 abstract public void writeObject(PDFWriter out)
 public PDF(Env env)
 {
     _out = new PDFWriter(env.getOut());
     _env = env;
 }