Examples of PdfArray


Examples of com.lowagie.text.pdf.PdfArray

 
  protected void createTrStartTag()
  {
    PdfStructureElement tableRowTag = new PdfStructureElement((PdfStructureElement)tagStack.peek(), new PdfName("TR"));
    pdfContentByte.beginMarkedContentSequence(tableRowTag);
    tableRowTag.put(PdfName.K, new PdfArray());
    tagStack.push(tableRowTag);
  }
View Full Code Here

Examples of com.lowagie.text.pdf.PdfArray

 
  protected void createThStartTag(JRPrintElement element)
  {
    PdfStructureElement tableHeaderTag = new PdfStructureElement((PdfStructureElement)tagStack.peek(), new PdfName("TH"));
    pdfContentByte.beginMarkedContentSequence(tableHeaderTag);
    tableHeaderTag.put(PdfName.K, new PdfArray());
    tagStack.push(tableHeaderTag);
    isTagEmpty = true;
   
    createSpanTags(element, tableHeaderTag);
  }
View Full Code Here

Examples of com.lowagie.text.pdf.PdfArray

 
  protected void createTdStartTag(JRPrintElement element)
  {
    PdfStructureElement tableCellTag = new PdfStructureElement((PdfStructureElement)tagStack.peek(), new PdfName("TD"));
    pdfContentByte.beginMarkedContentSequence(tableCellTag);
    tableCellTag.put(PdfName.K, new PdfArray());
    tagStack.push(tableCellTag);
    isTagEmpty = true;
   
    createSpanTags(element, tableCellTag);
  }
View Full Code Here

Examples of com.lowagie.text.pdf.PdfArray

        rowSpan = Integer.valueOf(element.getPropertiesMap().getProperty(JRCellContents.PROPERTY_ROW_SPAN)).intValue();
      } catch (NumberFormatException ex) {}
    }
    if (colSpan > 1 || rowSpan > 1)
    {
      PdfArray a = new PdfArray();
      PdfDictionary dict = new PdfDictionary();
      if (colSpan > 1)
      {
        dict.put(new PdfName("ColSpan"), new PdfNumber(colSpan));
      }
      if (rowSpan > 1)
      {
        dict.put(new PdfName("RowSpan"), new PdfNumber(rowSpan));
      }
      dict.put(PdfName.O, new PdfName("Table"));
      a.add(dict);
      parentTag.put(PdfName.A, a);
    }
  }
View Full Code Here

Examples of com.lowagie.text.pdf.PdfArray

      HashMap assets = new HashMap();
      assets.put("map.swf", swfRef.getIndirectReference());
      PdfDictionary assetsDictionary = PdfNameTree.writeTree(assets, writer);
      content.put(new PdfName("Assets"), assetsDictionary);
     
      PdfArray configurations = new PdfArray();
      PdfDictionary configuration = new PdfDictionary();
     
      PdfArray instances = new PdfArray();
      PdfDictionary instance = new PdfDictionary();
      instance.put(new PdfName("Subtype"), new PdfName("Flash"));
      PdfDictionary params = new PdfDictionary();
     
      String chartData = (String) element.getParameterValue(PARAMETER_CHART_DATA);
      String vars = "inline_data=" + chartData;
      params.put(new PdfName("FlashVars"), new PdfString(vars));
      instance.put(new PdfName("Params"), params);
      instance.put(new PdfName("Asset"), swfRef.getIndirectReference());
      PdfIndirectObject instanceRef = writer.addToBody(instance);
      instances.add(instanceRef.getIndirectReference());
      configuration.put(new PdfName("Instances"), instances);
     
      PdfIndirectObject configurationRef = writer.addToBody(configuration);
      configurations.add(configurationRef.getIndirectReference());
      content.put(new PdfName("Configurations"), configurations);
View Full Code Here

Examples of org.apache.fop.pdf.PDFArray

    /** {@inheritDoc} */
    public void populateXObjectDictionary(PDFDictionary dict) {
        ColorModel cm = getEffectiveColorModel();
        if (cm instanceof IndexColorModel) {
            IndexColorModel icm = (IndexColorModel)cm;
            PDFArray indexed = new PDFArray(dict);
            indexed.add(new PDFName("Indexed"));
           
            if (icm.getColorSpace().getType() != ColorSpace.TYPE_RGB) {
                log.warn("Indexed color space is not using RGB as base color space."
                        + " The image may not be handled correctly."
                        + " Base color space: " + icm.getColorSpace()
                        + " Image: " + image.getInfo());
            }
            indexed.add(new PDFName(toPDFColorSpace(icm.getColorSpace()).getName()));
            int c = icm.getMapSize();
            int hival = c - 1;
            if (hival > MAX_HIVAL) {
                throw new UnsupportedOperationException("hival must not go beyond " + MAX_HIVAL);
            }
            indexed.add(new Integer(hival));
            int[] palette = new int[c];
            icm.getRGBs(palette);
            ByteArrayOutputStream baout = new ByteArrayOutputStream();
            for (int i = 0; i < c; i++) {
                //TODO Probably doesn't work for non RGB based color spaces
                //See log warning above
                int entry = palette[i];
                baout.write((entry & 0xFF0000) >> 16);
                baout.write((entry & 0xFF00) >> 8);
                baout.write(entry & 0xFF);
            }
            indexed.add(baout.toByteArray());

            dict.put("ColorSpace", indexed);
            dict.put("BitsPerComponent", icm.getPixelSize());
           
            Integer index = getIndexOfFirstTransparentColorInPalette(getImage().getRenderedImage());
            if (index != null) {
                PDFArray mask = new PDFArray(dict);
                mask.add(index);
                mask.add(index);
                dict.put("Mask", mask);
            }
        }
    }
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

      for(int index = 0, length = operands.size(); index < length; index++)
      {
        PdfDirectObject operand = operands.get(index);
        if(operand instanceof PdfArray)
        {
          PdfArray operandElements = (PdfArray)operand;
          int operandElementIndex = -1;
          for(PdfDirectObject operandElement : operandElements)
          {
            model.addRow(
              new Object[]
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

  */
  public void setObjects(
    Collection<PdfObjectWrapper<?>> value
    )
  {
    PdfArray objectsDataObject = new PdfArray();
    for(PdfObjectWrapper<?> item : value)
    {
      if(item instanceof Annotation)
        objectsDataObject.add(
          item.getBaseObject()
          );
      else if(item instanceof Field)
        objectsDataObject.add(
          new PdfTextString(((Field)item).getFullName())
          );
      else
        throw new IllegalArgumentException(
          "Invalid 'Hide' action target type (" + item.getClass().getName() + ").\n"
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

            stream.seek(oldOffset); // Restores postcondition (last token should be the dictionary end).

            return dictionary;
          }
        case ArrayBegin:
          PdfArray array = new PdfArray();
          while(true)
          {
            // Value.
            moveNext(); if(tokenType == TokenTypeEnum.ArrayEnd) break;
            // Add the current item to the array!
            array.add((PdfDirectObject)parsePdfObject());
          }
          return array;
        case Real:
          return new PdfReal((Float)token);
        case Boolean:
View Full Code Here

Examples of org.pdfclown.objects.PdfArray

  private void flush(
    IOutputStream stream
    )
  {
    // 1. Body.
    final PdfArray indexArray = new PdfArray();
    final int[] entryFieldSizes = new int[]
      {
        EntryField0Size,
        getFieldSize((int)stream.getLength()), // NOTE: We assume this xref stream is the last indirect object.
        EntryField2Size
      };
    {
      // Get the stream buffer!
      final IBuffer body = getBody();

      // Delete the old entries!
      body.setLength(0);

      // Serializing the entries into the stream buffer...
      int prevObjectNumber = -2; // Previous-entry object number.
      for(XRefEntry entry : entries.values())
      {
        int entryNumber = entry.getNumber();
        if(entryNumber - prevObjectNumber != 1) // Current subsection terminated.
        {
          if(!indexArray.isEmpty())
          {indexArray.add(new PdfInteger(prevObjectNumber-((PdfInteger)indexArray.get(indexArray.size()-1)).getValue()+1));} // Number of entries in the previous subsection.
          indexArray.add(new PdfInteger(entryNumber)); // First object number in the next subsection.
        }
        prevObjectNumber = entryNumber;

        switch(entry.getUsage())
        {
          case Free:
            body.append((byte)FreeEntryType);
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getGeneration(),entryFieldSizes[2]));
            break;
          case InUse:
            body.append((byte)InUseEntryType);
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getGeneration(),entryFieldSizes[2]));
            break;
          case InUseCompressed:
            body.append((byte)InUseCompressedEntryType);
            body.append(numberToByteArray(entry.getStreamNumber(),entryFieldSizes[1]));
            body.append(numberToByteArray(entry.getOffset(),entryFieldSizes[2]));
            break;
          default:
            throw new UnsupportedOperationException();
        }
      }
      indexArray.add(new PdfInteger(prevObjectNumber-((PdfInteger)indexArray.get(indexArray.size()-1)).getValue()+1)); // Number of entries in the previous subsection.
    }

    // 2. Header.
    {
      final PdfDictionary header = getHeader();
      header.put(
        PdfName.Index,
        indexArray
        );
      header.put(
        PdfName.Size,
        new PdfInteger(file.getIndirectObjects().size()+1)
        );
      header.put(
        PdfName.W,
        new PdfArray(
          new PdfInteger(entryFieldSizes[0]),
          new PdfInteger(entryFieldSizes[1]),
          new PdfInteger(entryFieldSizes[2])
          )
        );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.