Package org.pdfsam.console.business.dto

Examples of org.pdfsam.console.business.dto.Bounds


   * validates the input bounds list ensuring that there is no intersections between the objects of the input list
   * @param bounds
   */
  public static void assertNotIntersectedBoundsList(List bounds) throws ValidationException {
    for (int i = 0; i < bounds.size(); i++) {
      Bounds victim = (Bounds) bounds.get(i);
      for (int j = i + 1; j < bounds.size(); j++) {
        Bounds current = (Bounds) bounds.get(j);
        if (victim.intersects(current)) {
          throw new ValidationException(ValidationException.ERR_BOUNDS_INTERSECTS, new String[] { victim.toString(),
              current.toString() });
        }
      }
    }
  }
View Full Code Here


                    List boundsList = getBounds(pdfNumberOfPages, selectionGroups);
                    ValidationUtility.assertNotIntersectedBoundsList(boundsList);
                    String boundsString = "";

                    for (Iterator iter = boundsList.iterator(); iter.hasNext();) {
                        Bounds bounds = (Bounds) iter.next();
                        boundsString += (boundsString.length() > 0) ? "," + bounds.toString() : bounds.toString();

                        // bookmarks
                        List bookmarks = bookmarkProcessor.processBookmarks(bounds.getStart(), bounds.getEnd(),
                                pageOffset);
                        if (bookmarks != null) {
                            master.addAll(bookmarks);
                        }
                        int relativeOffset = (bounds.getEnd() - bounds.getStart()) + 1;
                        currentDocumentPages += relativeOffset;
                        pageOffset += relativeOffset;
                    }

                    // add pages
View Full Code Here

     * @throws ConcatException
     */
    private List getBounds(int pdfNumberOfPages, String[] selections) throws ValidationException, ConcatException {
        ArrayList retVal = new ArrayList();
        for (int i = 0; i < selections.length; i++) {
            Bounds bounds = getBounds(pdfNumberOfPages, selections[i]);
            ValidationUtility.assertValidBounds(bounds, pdfNumberOfPages);
            retVal.add(bounds);
        }
        return retVal;
    }
View Full Code Here

        }
        return retVal;
    }

    private Bounds getBounds(int pdfNumberOfPages, String currentPageSelection) throws ConcatException {
        Bounds retVal = new Bounds(1, pdfNumberOfPages);
        if (!(ValidationUtility.ALL_STRING.equals(currentPageSelection))) {
            String[] limits = currentPageSelection.split("-");
            try {
                retVal.setStart(Integer.parseInt(limits[0]));
                // if there's an end limit
                if (limits.length > 1) {
                    retVal.setEnd(Integer.parseInt(limits[1]));
                } else {
                    // difference between '4' and '4-'
                    if (currentPageSelection.indexOf('-') == -1) {
                        retVal.setEnd(Integer.parseInt(limits[0]));
                    } else {
                        retVal.setEnd(pdfNumberOfPages);
                    }
                }
            } catch (NumberFormatException nfe) {
                throw new ConcatException(ConcatException.ERR_SYNTAX, new String[] { "" + currentPageSelection }, nfe);
            }
View Full Code Here

TOP

Related Classes of org.pdfsam.console.business.dto.Bounds

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.