Package org.pdfsam.guiclient.exceptions

Examples of org.pdfsam.guiclient.exceptions.ThumbnailCreationException


    BufferedImage retVal = null;
    if(fileName != null && fileName.length()>0){
        File inputFile = new File(fileName);
        retVal = getPageImage(inputFile, password, page, rotation);
    }else{
      throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Unable to create image for a null input document"));
    }
    return retVal;
  }
View Full Code Here


    BufferedImage retVal = null;
    if(fileName != null && fileName.length()>0){
      File inputFile = new File(fileName);
        retVal = getThumbnail(inputFile, password, page, resizePercentage);
    }else{
      throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"Unable to create image for a null input document"));
    }
    return retVal;   
  }
View Full Code Here

              BufferedImage.TYPE_INT_RGB);
          Graphics g = retVal.getGraphics();
          g.drawImage(rotated, 0, 0, null);
        }
      } catch (Throwable t) {
        throw new ThumbnailCreationException(t);
      } finally {
        if (graphics != null) {
          graphics.dispose();
        }
      }
    } else {
      throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
          .getI18nResourceBundle(), "Input file doesn't exists or is a directory"));
    }
    return retVal;

  }
View Full Code Here

    BufferedImage tempImage = getPageImage(inputFile, password, page);
    try {
      retVal = ImageUtility.getScaledInstance(tempImage, Math.round(tempImage.getWidth(null) * resizePercentage),
          Math.round(tempImage.getHeight(null) * resizePercentage));
    } catch (Exception e) {
      throw new ThumbnailCreationException(e);
    }
    return retVal;
  }
View Full Code Here

            }
          }
        }
      }
    } catch (IOException ioe) {
      throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
          .getI18nResourceBundle(), "Error opening pdf document")
          + " " + inputFile.getAbsolutePath(), ioe);
    }
    return modelList;
  }
View Full Code Here

              providedPwd = DialogUtility.askForDocumentPasswordDialog(getPanel(), inputFile.getName());
              if (providedPwd != null && providedPwd.length() > 0) {
                setProvidedPassword(providedPwd);
                pdfDoc = openDoc(inputFile, providedPwd);
              } else {
                throw new ThumbnailCreationException(GettextResource.gettext(Configuration
                    .getInstance().getI18nResourceBundle(), "Password not provided."));
              }
            } else {
              throw new ThumbnailCreationException(ioe);
            }
          }
          if (pdfDoc != null) {
            // require password if encrypted
            // I already opened the document in visual mode but if
            // encrypted it will need
            // the password to manipulate
            if (pdfDoc.isEncrypted() && (providedPwd == null || providedPwd.length() == 0)) {
              providedPwd = DialogUtility.askForDocumentPasswordDialog(getPanel(), inputFile.getName());
              setProvidedPassword(providedPwd);
            }
            retVal = true;
          } else {
            throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
                .getI18nResourceBundle(), "Unable to open the document."));
          }
        } catch (IOException ioe) {
          throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
              .getI18nResourceBundle(), "Error opening pdf document")
              + " " + inputFile.getAbsolutePath(), ioe);
        } catch (COSLoadException cle) {
          throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
              .getI18nResourceBundle(), "Error opening pdf document")
              + " " + inputFile.getAbsolutePath(), cle);
        } catch (OutOfMemoryError oom) {
          throw new ThumbnailCreationException(GettextResource.gettext(Configuration.getInstance()
              .getI18nResourceBundle(), "Not enough memory to create thumbnails")
              + " " + inputFile.getAbsolutePath(), oom);
        }
      } else {
        log.error(GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),
View Full Code Here

TOP

Related Classes of org.pdfsam.guiclient.exceptions.ThumbnailCreationException

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.