Package com.itextpdf.text.pdf

Examples of com.itextpdf.text.pdf.ByteBuffer


            if (dg2 != null) {
              dg2.dispose();
              dg2 = null;
            }
            if (kids != null) {
                ByteBuffer buf = new ByteBuffer();
                internalDispose(buf);
                ByteBuffer buf2 = cb.getInternalBuffer();
                buf2.reset();
                buf2.append(buf);
            }
        }
    }
View Full Code Here


    }

    private void internalDispose(ByteBuffer buf) {
        int last = 0;
        int pos = 0;
        ByteBuffer buf2 = cb.getInternalBuffer();
        if (kids != null) {
            for (Kid kid: kids) {
                pos = kid.pos;
                PdfGraphics2D g2 = kid.graphics;
                g2.cb.restoreState();
                g2.cb.restoreState();
                buf.append(buf2.getBuffer(), last, pos - last);
                if (g2.dg2 != null) {
                  g2.dg2.dispose();
                  g2.dg2 = null;
                }
                g2.internalDispose(buf);
                last = pos;
            }
        }
        buf.append(buf2.getBuffer(), last, buf2.size() - last);
    }
View Full Code Here

   * Converts an array of bytes to a String of hexadecimal values
   * @param bytes  a byte array
   * @return  the same bytes expressed as hexadecimal values
   */
  public static String convertToHex(byte[] bytes) {
      ByteBuffer buf = new ByteBuffer();
      for (byte b : bytes) {
          buf.appendHex(b);
      }
      return PdfEncodings.convertToString(buf.toByteArray(), null).toUpperCase();
  }
View Full Code Here

                if (colorType == 3) {
                    PdfArray colorspace = new PdfArray();
                    colorspace.add(PdfName.INDEXED);
                    colorspace.add(getColorspace());
                    colorspace.add(new PdfNumber(len / 3 - 1));
                    ByteBuffer colortable = new ByteBuffer();
                    while ((len--) > 0) {
                        colortable.append_i(is.read());
                    }
                    colorspace.add(new PdfString(colorTable = colortable.toByteArray()));
                    additional.put(PdfName.COLORSPACE, colorspace);
                }
                else {
                    Utilities.skip(is, len);
                }
View Full Code Here

            if (dg2 != null) {
              dg2.dispose();
              dg2 = null;
            }
            if (kids != null) {
                ByteBuffer buf = new ByteBuffer();
                internalDispose(buf);
                ByteBuffer buf2 = cb.getInternalBuffer();
                buf2.reset();
                buf2.append(buf);
            }
        }
    }
View Full Code Here

    }

    private void internalDispose(ByteBuffer buf) {
        int last = 0;
        int pos = 0;
        ByteBuffer buf2 = cb.getInternalBuffer();
        if (kids != null) {
            for (Kid kid: kids) {
                pos = kid.pos;
                PdfGraphics2D g2 = kid.graphics;
                g2.cb.restoreState();
                g2.cb.restoreState();
                buf.append(buf2.getBuffer(), last, pos - last);
                if (g2.dg2 != null) {
                  g2.dg2.dispose();
                  g2.dg2 = null;
                }
                g2.internalDispose(buf);
                last = pos;
            }
        }
        buf.append(buf2.getBuffer(), last, buf2.size() - last);
    }
View Full Code Here

                if (colorType == 3) {
                    PdfArray colorspace = new PdfArray();
                    colorspace.add(PdfName.INDEXED);
                    colorspace.add(getColorspace());
                    colorspace.add(new PdfNumber(len / 3 - 1));
                    ByteBuffer colortable = new ByteBuffer();
                    while ((len--) > 0) {
                        colortable.append_i(is.read());
                    }
                    colorspace.add(new PdfString(colorTable = colortable.toByteArray()));
                    additional.put(PdfName.COLORSPACE, colorspace);
                }
                else {
                    Utilities.skip(is, len);
                }
View Full Code Here

   * Converts an array of bytes to a String of hexadecimal values
   * @param bytes  a byte array
   * @return  the same bytes expressed as hexadecimal values
   */
  public static String convertToHex(byte[] bytes) {
      ByteBuffer buf = new ByteBuffer();
      for (byte b : bytes) {
          buf.appendHex(b);
      }
      return PdfEncodings.convertToString(buf.toByteArray(), null).toUpperCase();
  }
View Full Code Here

                if (colorType == 3) {
                    PdfArray colorspace = new PdfArray();
                    colorspace.add(PdfName.INDEXED);
                    colorspace.add(getColorspace());
                    colorspace.add(new PdfNumber(len / 3 - 1));
                    ByteBuffer colortable = new ByteBuffer();
                    while ((len--) > 0) {
                        colortable.append_i(is.read());
                    }
                    colorspace.add(new PdfString(colorTable = colortable.toByteArray()));
                    additional.put(PdfName.COLORSPACE, colorspace);
                }
                else {
                    Utilities.skip(is, len);
                }
View Full Code Here

        etExtra = true;
      }
      // Writing the marked-content sequence with the Do operator
      // Note that the position assumes that the CTM wasn't changed in the graphics state
      // TODO: do the math if the CTM did change!
      ByteBuffer buf = new ByteBuffer();
      buf.append("/P <</MCID ");
      buf.append(mcid);
      buf.append(">> BDC\n");
      buf.append("q 1 0 0 1 ");
      buf.append(rect.getLeft());
      buf.append(" ");
      buf.append(rect.getBottom());
      buf.append(" cm ");
      buf.append(xobj.getBytes());
      buf.append(" Do Q\n");
      buf.append("EMC\n");
      buf.flush();
      buf.writeTo(baos);
      // if we were inside a text block, we've introduced an ET, so we'll need to write a BT
      if (inText)
        btWrite = true;
    }
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.ByteBuffer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.