Package org.pdfsam.console.business.dto

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


              if (ALL_STRING.equals(pageNumber)) {
                if (!retVal.isEmpty()) {
                  LOG.warn("Page rotation for every page found, other rotations removed");
                  retVal.clear();
                }
                retVal.add(new PageRotation(PageRotation.NO_PAGE, degrees, PageRotation.ALL_PAGES));
                break;
              } else if (ODD_STRING.equals(pageNumber)) {
                if (!retVal.isEmpty()) {
                  LOG.warn("Page rotation for odd pages found, other rotations removed");
                  retVal.clear();
                }
                retVal.add(new PageRotation(PageRotation.NO_PAGE, degrees, PageRotation.ODD_PAGES));
                break;
              } else if (EVEN_STRING.equals(pageNumber)) {
                if (!retVal.isEmpty()) {
                  LOG.warn("Page rotation for even pages found, other rotations removed");
                  retVal.clear();
                }
                retVal.add(new PageRotation(PageRotation.NO_PAGE, degrees, PageRotation.EVEN_PAGES));
                break;
              } else {
                if (allowSinglePagesRotation) {
                  retVal.add(new PageRotation(Integer.parseInt(pageNumber), degrees));
                }
              }
            } else {
              throw new ValidationException(ValidationException.ERR_PARAM_ROTATION, new String[] { currentRotation });
            }
View Full Code Here


                                fileList[i].getPasswordBytes());
                        pdfReader.removeUnusedObjects();
                        pdfReader.consolidateNamedDestinations();

                        int pdfNumberOfPages = pdfReader.getNumberOfPages();
                        PageRotation rotation = inputCommand.getRotation();
                        // rotate all
                        if (rotation.getType() == PageRotation.ALL_PAGES) {
                            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));
View Full Code Here

TOP

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

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.