Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.PdfNumber


    /**
     * A content operator implementation (TL).
     */
    private static class SetTextLeading implements ContentOperator{
        public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) {
            PdfNumber leading = (PdfNumber)operands.get(0);
            processor.gs().leading = leading.floatValue();
        }
View Full Code Here


    /**
     * A content operator implementation (Tz).
     */
    private static class SetTextHorizontalScaling implements ContentOperator{
        public void invoke(PdfContentStreamProcessor processor, PdfLiteral operator, ArrayList operands) {
            PdfNumber scale = (PdfNumber)operands.get(0);
            processor.gs().horizontalScaling = scale.floatValue();
        }
View Full Code Here

                for (int i = 0; i < rotations.length; i++) {
                    if (pdfNumberOfPages >= rotations[i].getPageNumber() && rotations[i].getPageNumber() > 0) {
                        PdfDictionary dictionary = rotationReader.getPageN(rotations[i].getPageNumber());
                        int rotation = (rotations[i].getDegrees() + rotationReader.getPageRotation(rotations[i]
                                .getPageNumber())) % 360;
                        dictionary.put(PdfName.ROTATE, new PdfNumber(rotation));
                    } else {
                        LOG.warn("Rotation for page " + rotations[i].getPageNumber() + " ignored.");
                    }
                }
            } else {
                // rotate all
                if (rotations[0].getType() == PageRotation.ALL_PAGES) {
                    int pageRotation = rotations[0].getDegrees();
                    for (int i = 1; i <= pdfNumberOfPages; i++) {
                        PdfDictionary dictionary = rotationReader.getPageN(i);
                        int rotation = (pageRotation + rotationReader.getPageRotation(i)) % 360;
                        dictionary.put(PdfName.ROTATE, new PdfNumber(rotation));
                    }
                } else if (rotations[0].getType() == PageRotation.SINGLE_PAGE) {
                    // single page rotation
                    if (pdfNumberOfPages >= rotations[0].getPageNumber() && rotations[0].getPageNumber() > 0) {
                        PdfDictionary dictionary = rotationReader.getPageN(rotations[0].getPageNumber());
                        int rotation = (rotations[0].getDegrees() + rotationReader.getPageRotation(rotations[0]
                                .getPageNumber())) % 360;
                        dictionary.put(PdfName.ROTATE, new PdfNumber(rotation));
                    } else {
                        LOG.warn("Rotation for page " + rotations[0].getPageNumber() + " ignored.");
                    }
                } else if (rotations[0].getType() == PageRotation.ODD_PAGES) {
                    // odd pages rotation
                    int pageRotation = rotations[0].getDegrees();
                    for (int i = 1; i <= pdfNumberOfPages; i = i + 2) {
                        PdfDictionary dictionary = rotationReader.getPageN(i);
                        int rotation = (pageRotation + rotationReader.getPageRotation(i)) % 360;
                        dictionary.put(PdfName.ROTATE, new PdfNumber(rotation));
                    }
                } else if (rotations[0].getType() == PageRotation.EVEN_PAGES) {
                    // even pages rotation
                    int pageRotation = rotations[0].getDegrees();
                    for (int i = 2; i <= pdfNumberOfPages; i = i + 2) {
                        PdfDictionary dictionary = rotationReader.getPageN(i);
                        int rotation = (pageRotation + rotationReader.getPageRotation(i)) % 360;
                        dictionary.put(PdfName.ROTATE, new PdfNumber(rotation));
                    }
                } else {
                    LOG.warn("Unable to find the rotation type. " + rotations[0]);
                }
            }
View Full Code Here

    {
      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

      {
        // add the Adobe 1.7 extensions catalog dictionary
        PdfDictionary extensions = new PdfDictionary();
        PdfDictionary adobeExtension = new PdfDictionary();
        adobeExtension.put(new PdfName("BaseVersion"), PdfWriter.PDF_VERSION_1_7);
        adobeExtension.put(new PdfName("ExtensionLevel"), new PdfNumber(3));
        extensions.put(new PdfName("ADBE"), adobeExtension);
        writer.getExtraCatalog().put(new PdfName("Extensions"), extensions);
       
        // add the swf file
        byte[] swfData = readSwf();
View Full Code Here

                            int pageRotation = rotation.getDegrees();
                            LOG.debug("Applying rotation of " + pageRotation + " for all pages");
                            for (int j = 1; j <= pdfNumberOfPages; j++) {
                                PdfDictionary dictionary = pdfReader.getPageN(j);
                                int rotationDegrees = (pageRotation + pdfReader.getPageRotation(j)) % 360;
                                dictionary.put(PdfName.ROTATE, new PdfNumber(rotationDegrees));
                            }
                        } else if (rotation.getType() == PageRotation.ODD_PAGES) {
                            // odd pages rotation
                            int pageRotation = rotation.getDegrees();
                            LOG.debug("Applying rotation of " + pageRotation + " for odd pages");
                            for (int j = 1; j <= pdfNumberOfPages; j = j + 2) {
                                PdfDictionary dictionary = pdfReader.getPageN(j);
                                int rotationDegrees = (pageRotation + pdfReader.getPageRotation(j)) % 360;
                                dictionary.put(PdfName.ROTATE, new PdfNumber(rotationDegrees));
                            }
                        } else if (rotation.getType() == PageRotation.EVEN_PAGES) {
                            // even pages rotation
                            int pageRotation = rotation.getDegrees();
                            LOG.debug("Applying rotation of " + pageRotation + " for even pages");
                            for (int j = 2; j <= pdfNumberOfPages; j = j + 2) {
                                PdfDictionary dictionary = pdfReader.getPageN(j);
                                int rotationDegrees = (pageRotation + pdfReader.getPageRotation(j)) % 360;
                                dictionary.put(PdfName.ROTATE, new PdfNumber(rotationDegrees));
                            }
                        } else {
                            LOG.warn("Unable to find the rotation type. " + rotation);
                        }
View Full Code Here

          + "*" + 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();
View Full Code Here

                        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);
                }
View Full Code Here

            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) {
View Full Code Here

        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.PdfNumber

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.