Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfObject


  /**
   * Defines the sort order of the field (ascending or descending).
   * @param ascending  true is the default, use false for descending order
   */
  public void setSortOrder(boolean ascending) {
    PdfObject o = get(PdfName.S);
    if (o instanceof PdfName) {
      put(PdfName.A, new PdfBoolean(ascending));
    }
    else {
      throw new IllegalArgumentException(MessageLocalization.getComposedMessage("you.have.to.define.a.boolean.array.for.this.collection.sort.dictionary"));
View Full Code Here


  /**
   * Defines the sort order of the field (ascending or descending).
   * @param ascending  an array with every element corresponding with a name of a field.
   */
  public void setSortOrder(boolean[] ascending) {
    PdfObject o = get(PdfName.S);
    if (o instanceof PdfArray) {
      if (((PdfArray)o).size() != ascending.length) {
        throw new IllegalArgumentException(MessageLocalization.getComposedMessage("the.number.of.booleans.in.this.array.doesn.t.correspond.with.the.number.of.fields"));
      }
      PdfArray array = new PdfArray();
View Full Code Here

   * You can only use this method after you have set the value of the item.
   * @param prefix  a prefix
   */
  public void setPrefix(String key, String prefix) {
    PdfName fieldname = new PdfName(key);
    PdfObject o = get(fieldname);
    if (o == null)
      throw new IllegalArgumentException(MessageLocalization.getComposedMessage("you.must.set.a.value.before.adding.a.prefix"));
    PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM);
    dict.put(PdfName.D, o);
    dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE));
View Full Code Here

                dic.put(PdfName.GAMMA, new PdfNumber(gamma));
                dic.put(PdfName.WHITEPOINT, new PdfLiteral("[1 1 1]"));
                array.add(dic);
            }
            else {
                PdfObject wp = new PdfLiteral("[1 1 1]");
                array.add(PdfName.CALRGB);
                if (gamma != 1f) {
                    PdfArray gm = new PdfArray();
                    PdfNumber n = new PdfNumber(gamma);
                    gm.add(n);
View Full Code Here

     */
    private byte[] getContentBytesForPage(int pageNum) throws IOException {
        RandomAccessFileOrArray f = reader.getSafeFile();
        try{
            final PdfDictionary pageDictionary = reader.getPageN(pageNum);
            final PdfObject contentObject = pageDictionary.get(PdfName.CONTENTS);
            final byte[] contentBytes = getContentBytesFromContentObject(contentObject);
            return contentBytes;
        } finally {   
            f.close();
        }
View Full Code Here

          final byte[] result;
          switch (contentObject.type())
          {
            case PdfObject.INDIRECT:
              final PRIndirectReference ref = (PRIndirectReference) contentObject;
              final PdfObject directObject = PdfReader.getPdfObject(ref);
              result = getContentBytesFromContentObject(directObject);
              break;
            case PdfObject.STREAM:
              final PRStream stream = (PRStream) PdfReader.getPdfObject(contentObject);
              result = PdfReader.getStreamBytes(stream);
              break;
            case PdfObject.ARRAY:
              // Stitch together all content before calling processContent(), because
              // processContent() resets state.
              final ByteArrayOutputStream allBytes = new ByteArrayOutputStream();
              final PdfArray contentArray = (PdfArray) contentObject;
              final ListIterator iter = contentArray.listIterator();
              while (iter.hasNext())
              {
                final PdfObject element = (PdfObject) iter.next();
                allBytes.write(getContentBytesFromContentObject(element));
              }
              result = allBytes.toByteArray();
              break;
            default:
View Full Code Here

        StringBuffer builder = new StringBuffer();
        builder.append('(');
        List subDictionaries = new ArrayList();
        for (Iterator i = dic.getKeys().iterator(); i.hasNext(); ) {
            PdfName key = (PdfName)i.next();
            PdfObject val = dic.getDirectObject(key);
            if (val.isDictionary())
                subDictionaries.add(key);
            builder.append(key);
            builder.append('=');
            builder.append(val);
            builder.append(", ");
View Full Code Here

    public static Image getInstance(PRIndirectReference ref) throws BadElementException {
        PdfDictionary dic = (PdfDictionary)PdfReader.getPdfObjectRelease(ref);
        int width = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.WIDTH))).intValue();
        int height = ((PdfNumber)PdfReader.getPdfObjectRelease(dic.get(PdfName.HEIGHT))).intValue();
        Image imask = null;
        PdfObject obj = dic.get(PdfName.SMASK);
        if (obj != null && obj.isIndirect()) {
            imask = getInstance((PRIndirectReference)obj);
        }
        else {
            obj = dic.get(PdfName.MASK);
            if (obj != null && obj.isIndirect()) {
                PdfObject obj2 = PdfReader.getPdfObjectRelease(obj);
                if (obj2 instanceof PdfDictionary)
                    imask = getInstance((PRIndirectReference)obj);
            }
        }
        Image img = new ImgRaw(width, height, 1, 1, null);
View Full Code Here

        if (additional == null)
            return;
        PdfArray value = additional.getAsArray(PdfName.COLORSPACE);
        if (value == null)
            return;
        PdfObject cs = simplifyColorspace(value);
        PdfObject newValue;
        if (cs.isName())
            newValue = cs;
        else {
            newValue = value;
            PdfName first = value.getAsName(0);
View Full Code Here

                        PdfObject tuValue = dict.get(new PdfName("/TU"));
                        annotation = tuValue.toString();
                    }
                    */
                   
                    PdfObject typeValue = null;
                    PdfObject tuValue = null;
                   
                    Set dictKeys = dict.getKeys();
                    Iterator dictKeyIter = dictKeys.iterator();
                    while (dictKeyIter.hasNext()) {
                        PdfName dictKeyName = (PdfName) dictKeyIter.next();
                        PdfObject dictObject = dict.get(dictKeyName);
                       
                        if ("/Type".equals(dictKeyName.toString())) {
                            typeValue = dictObject;
                        } else if ("/TU".equals(dictKeyName.toString())) {
                            tuValue = dictObject;
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.PdfObject

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.