Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfArray


      ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p3, 50, 500, 0);
      cb.endLayer();
      cb.sanityCheck();
     
      PdfOCProperties p = writer.getOCProperties();
      PdfArray order = new PdfArray();
      order.add(l1.getRef());
      order.add(l2.getRef());
      order.add(l3.getRef());
      PdfDictionary d = new PdfDictionary();
      d.put(PdfName.ORDER, order);
      p.put(PdfName.D, d);
      // step 5
      document.close();
View Full Code Here


        annotations = delayedAnnotations;
        delayedAnnotations = new ArrayList();
    }
   
    public PdfArray rotateAnnotations(PdfWriter writer, LwgRectangle pageSize) {
        PdfArray array = new PdfArray();
        int rotation = pageSize.getRotation() % 360;
        int currentPage = writer.getCurrentPageNumber();
        for (int k = 0; k < annotations.size(); ++k) {
            PdfAnnotation dic = (PdfAnnotation)annotations.get(k);
            int page = dic.getPlaceInPage();
            if (page > currentPage) {
                delayedAnnotations.add(dic);
                continue;
            }
            if (dic.isForm()) {
                if (!dic.isUsed()) {
                    HashMap templates = dic.getTemplates();
                    if (templates != null)
                        acroForm.addFieldTemplates(templates);
                }
                PdfFormField field = (PdfFormField)dic;
                if (field.getParent() == null)
                    acroForm.addDocumentField(field.getIndirectReference());
            }
            if (dic.isAnnotation()) {
                array.add(dic.getIndirectReference());
                if (!dic.isUsed()) {
                    PdfRectangle rect = (PdfRectangle)dic.get(PdfName.RECT);
                    if (rect != null) {
                      switch (rotation) {
                          case 90:
View Full Code Here

                out.put(PdfName.OUTPUTCONDITION, new PdfString("SWOP CGATS TR 001-1995"));
                out.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("CGATS TR 001"));
                out.put(PdfName.REGISTRYNAME, new PdfString("http://www.color.org"));
                out.put(PdfName.INFO, new PdfString(""));
                out.put(PdfName.S, PdfName.GTS_PDFX);
                extraCatalog.put(PdfName.OUTPUTINTENTS, new PdfArray(out));
            }
        }
    }
View Full Code Here

                  unpackedFiles += unpackFile(filespec, inputCommand.getOutputFile(), inputCommand.isOverwrite());
                }
              }
            }
            for (int k = 1; k <= pdfReader.getNumberOfPages(); ++k) {
              PdfArray annots = (PdfArray) PdfReader.getPdfObject(pdfReader.getPageN(k).get(PdfName.ANNOTS));
              if (annots != null){
                for (Iterator iter = annots.listIterator(); iter.hasNext();) {
                  PdfDictionary annot = (PdfDictionary) PdfReader.getPdfObject((PdfObject) iter.next());
                  PdfName subType = (PdfName) PdfReader.getPdfObject(annot.get(PdfName.SUBTYPE));
                  if (PdfName.FILEATTACHMENT.equals(subType)){
                    PdfDictionary filespec = (PdfDictionary) PdfReader.getPdfObject(annot.get(PdfName.FS));
                    unpackedFiles += unpackFile(filespec, inputCommand.getOutputFile(), inputCommand.isOverwrite());
View Full Code Here

      int pagenumber, RecursivePdfObjectIterator pageanalyzer, PdfReader pdfreader) {
    super(page);
    this.pagenumber = pagenumber;
    DefaultMutableTreeNode info;

    PdfArray arr = (PdfArray) page.get(PdfName.MEDIABOX);
    float curwidth = 0;
    float curheight = 0;
    if (arr != null) {
      ArrayList arl = arr.getArrayList();
      curwidth = Float.parseFloat(arl.get(2).toString());
      curheight = Float.parseFloat(arl.get(3).toString());
      info = new ObjectTreeNode(PdfName.MEDIABOX + " " + curwidth
          + "*" + curheight);
      this.add(info);

    }
    PdfArray arrcrop = (PdfArray) page.get(PdfName.CROPBOX);
    if (arrcrop != null) {
      ArrayList arl = arrcrop.getArrayList();
      curwidth = Float.parseFloat(arl.get(2).toString());
      curheight = Float.parseFloat(arl.get(3).toString());
      info = new ObjectTreeNode(PdfName.CROPBOX + " " + curwidth
          + "*" + curheight);
      this.add(info);

    }

    PdfNumber rotation = (PdfNumber) PdfReader.getPdfObject(page
        .get(PdfName.ROTATE));

    if (rotation == null) {
      System.out.println("Rotation missing");
      rotation = new PdfNumber(0);
    } else {
      info = new ObjectTreeNode(PdfName.ROTATE + " " + rotation);
      this.add(info);
    }
    Rectangle rect = new Rectangle(curwidth, curheight);

    if ((rotation.floatValue() == 90) || (rotation.floatValue() == 270)) {
      rect = rect.rotate();
    }

    width = rect.width();
    height = rect.height();

    PdfArray dict = (PdfArray) PdfReader.getPdfObject(page.get(PdfName.ANNOTS));
    if (dict != null) {
      this.add(new ObjectTreeNode(PdfName.ANNOTS + " " + dict.length()));
      ObjectTreeNode annots_node = new ObjectTreeNode(PdfName.ANNOTS  + " " + dict.type());
      this.add(annots_node);
      pageanalyzer.iterateObjects(dict, pdfreader, annots_node);

    }
    PdfObject reso = PdfReader.getPdfObject(page.get(PdfName.RESOURCES));
View Full Code Here

   */
  protected void iteratePages(PdfDictionary page, PdfReader pdfreader,
      DefaultMutableTreeNode node) {

    DefaultMutableTreeNode leaf;
    PdfArray kids_array = (PdfArray) PdfReader.getPdfObject(page.get(PdfName.KIDS));
    if (kids_array == null) {
      node.add(new PageTreeNode(page, pagecount, this, pdfreader));
      System.out.println("Page= " + (++pagecount));
    } else {
      leaf = new PagesTreeNode(kids_array);
      node.add(leaf);
      page.put(PdfName.TYPE, PdfName.PAGES);
      ArrayList kids = kids_array.getArrayList();
      for (int k = 0; k < kids.size(); ++k) {
        PdfDictionary kid = (PdfDictionary) PdfReader
            .getPdfObject((PRIndirectReference) kids.get(k));
        iteratePages(kid, pdfreader, leaf);
      }
View Full Code Here

            unpackFile(reader, filespec, outPath);
          }
        }
      }
      for (int k = 1; k <= reader.getNumberOfPages(); ++k) {
        PdfArray annots = (PdfArray) PdfReader.getPdfObject(reader
            .getPageN(k).get(PdfName.ANNOTS));
        if (annots == null)
          continue;
        for (Iterator i = annots.listIterator(); i.hasNext();) {
          PdfDictionary annot = (PdfDictionary) PdfReader
              .getPdfObject((PdfObject) i.next());
          PdfName subType = (PdfName) PdfReader.getPdfObject(annot
              .get(PdfName.SUBTYPE));
          if (!PdfName.FILEATTACHMENT.equals(subType))
View Full Code Here

                    for (int k = 0; k < gColor; ++k) {
                        palette[k * 3] = (byte)(rgb[k] >>> 8);
                        palette[k * 3 + 1] = (byte)(rgb[k + gColor] >>> 8);
                        palette[k * 3 + 2] = (byte)(rgb[k + bColor] >>> 8);
                    }
                    PdfArray indexed = new PdfArray();
                    indexed.add(PdfName.INDEXED);
                    indexed.add(PdfName.DEVICERGB);
                    indexed.add(new PdfNumber(gColor - 1));
                    indexed.add(new PdfString(palette));
                    PdfDictionary additional = new PdfDictionary();
                    additional.put(PdfName.COLORSPACE, indexed);
                    img.setAdditional(additional);
                }
                img.setOriginalType(LwgImage.ORIGINAL_TIFF);
View Full Code Here

            skip();
       
        LwgImage img = null;
        try {
            img = new ImgRaw(iw, ih, 1, m_bpc, m_out);
            PdfArray colorspace = new PdfArray();
            colorspace.add(PdfName.INDEXED);
            colorspace.add(PdfName.DEVICERGB);
            int len = m_curr_table.length;
            colorspace.add(new PdfNumber(len / 3 - 1));
            colorspace.add(new PdfString(m_curr_table));
            PdfDictionary ad = new PdfDictionary();
            ad.put(PdfName.COLORSPACE, colorspace);
            img.setAdditional(ad);
            if (transparency) {
                img.setTransparency(new int[]{transIndex, transIndex});
View Full Code Here

        return null;
    }
   
    private LwgImage indexedModel(byte bdata[], int bpc, int paletteEntries) throws BadElementException {
        LwgImage img = new ImgRaw(width, height, 1, bpc, bdata);
        PdfArray colorspace = new PdfArray();
        colorspace.add(PdfName.INDEXED);
        colorspace.add(PdfName.DEVICERGB);
        byte np[] = getPalette(paletteEntries);
        int len = np.length;
        colorspace.add(new PdfNumber(len / 3 - 1));
        colorspace.add(new PdfString(np));
        PdfDictionary ad = new PdfDictionary();
        ad.put(PdfName.COLORSPACE, colorspace);
        img.setAdditional(ad);
        return img;
    }
View Full Code Here

TOP

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

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.