Package de.intarsys.pdf.pd

Examples of de.intarsys.pdf.pd.PDPage


    IGraphicsContext graphics = null;
    PDDocument pdfDoc = null;
    if (inputFile != null && inputFile.exists() && inputFile.isFile()) {
      try {
        pdfDoc = openDoc(inputFile, password);
        PDPage pdPage = pdfDoc.getPageTree().getPageAt(page - 1);
        Rectangle2D rect = pdPage.getCropBox().toNormalizedRectangle();

        retVal = new BufferedImage((int) rect.getWidth(), (int) rect.getHeight(), BufferedImage.TYPE_INT_RGB);
        Graphics2D g2 = (Graphics2D) retVal.getGraphics();
        graphics = new CwtAwtGraphicsContext(g2);
        // setup user space
        AffineTransform imgTransform = graphics.getTransform();
        imgTransform.scale(1, -1);
        imgTransform.translate(-rect.getMinX(), -rect.getMaxY());
        graphics.setTransform(imgTransform);
        graphics.setBackgroundColor(Color.WHITE);
        graphics.fill(rect);
        CSContent content = pdPage.getContentStream();
        if (content != null) {
          JPodRenderer renderer = new JPodRenderer(null, graphics);
          renderer.process(content, pdPage.getResources());
        }
        if (pdfDoc != null) {
          pdfDoc.close();
        }
        int totalRotation = (rotation + pdPage.getRotate()) % 360;
        if (totalRotation != 0) {
          Image rotated = ImageUtility.rotateImage(retVal, totalRotation);
          retVal = new BufferedImage(rotated.getWidth(null), rotated.getHeight(null),
              BufferedImage.TYPE_INT_RGB);
          Graphics g = retVal.getGraphics();
View Full Code Here


      throws ThumbnailCreationException {
    ArrayList<JPodThmbnailCallable> tasks = null;
    if (pageTree != null && modelList != null && modelList.size() > 0) {
      tasks = new ArrayList<JPodThmbnailCallable>(modelList.size());
      for (VisualPageListItem pageItem : modelList) {
        PDPage pdPage = pageTree.getPageAt(pageItem.getPageNumber() - 1);
        tasks.add(new JPodThmbnailCallable(pdPage, pageItem, getPanel(), getCurrentId()));
      }
    }
    return tasks;
  }
View Full Code Here

TOP

Related Classes of de.intarsys.pdf.pd.PDPage

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.