Examples of PdfFile


Examples of jcmdline.dto.PdfFile

          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(SplitParsedCommand.F_ARG);          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName());
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
View Full Code Here

Examples of jcmdline.dto.PdfFile

          }

          //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption("f");          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName());
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
         
View Full Code Here

Examples of jcmdline.dto.PdfFile

      }
     
      //-f
          PdfFileParam fOption = (PdfFileParam) cmdLineHandler.getOption(DocumentInfoParsedCommand.F_ARG);          
          if(fOption.isSet()){
            PdfFile inputFile = fOption.getPdfFile();
            ValidationUtility.assertValidPdfExtension(inputFile.getFile().getName());
              parsedCommandDTO.setInputFile(FileUtility.getPdfFile(inputFile));                 
          }else{
            throw new ParseException(ParseException.ERR_NO_F)
          }
         
View Full Code Here

Examples of jcmdline.dto.PdfFile

          }
         
          //-f1
      PdfFileParam f1Option = (PdfFileParam) cmdLineHandler.getOption(MixParsedCommand.F1_ARG);          
          if(f1Option.isSet()){
            PdfFile firstFile = f1Option.getPdfFile();
             //checking extension
              ValidationUtility.assertValidPdfExtension(firstFile.getFile().getName());
              parsedCommandDTO.setFirstInputFile(FileUtility.getPdfFile(firstFile));                               
          }else{
            throw new ParseException(ParseException.ERR_NO_F1)
          }
         
          //-f2
          PdfFileParam f2Option = (PdfFileParam) cmdLineHandler.getOption(MixParsedCommand.F2_ARG);          
          if(f2Option.isSet()){
            PdfFile secondFile = f2Option.getPdfFile();
             //checking extension
              ValidationUtility.assertValidPdfExtension(secondFile.getFile().getName());
               parsedCommandDTO.setSecondInputFile(FileUtility.getPdfFile(secondFile));
          }else{
            throw new ParseException(ParseException.ERR_NO_F2)
          }          
 
View Full Code Here

Examples of jcmdline.dto.PdfFile

      if(fOption.isSet() || dOption.isSet()){
        //-f
            if(fOption.isSet()){
          //validate file extensions
              for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
                PdfFile currentFile = (PdfFile) fIterator.next();
                ValidationUtility.assertValidPdfExtension(currentFile.getFile().getName());             
              }
              parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
            }
            //-d
        if ((dOption.isSet())){
View Full Code Here

Examples of jcmdline.dto.PdfFile

      if(lOption.isSet() || fOption.isSet() || dOption.isSet()){
        if(lOption.isSet() ^ fOption.isSet() ^ dOption.isSet()){
          if(fOption.isSet()){
            //validate file extensions
            for(Iterator fIterator = fOption.getPdfFiles().iterator(); fIterator.hasNext();){
              PdfFile currentFile = (PdfFile) fIterator.next();
                  if (!((currentFile.getFile().getName().toLowerCase().endsWith(PDF_EXTENSION)) && (currentFile.getFile().getName().length()>PDF_EXTENSION.length()))){
                    throw new ParseException(ParseException.ERR_IN_NOT_PDF, new String[]{currentFile.getFile().getPath()});
                  }
                }
            parsedCommandDTO.setInputFileList(FileUtility.getPdfFiles(fOption.getPdfFiles()));
          }else if(lOption.isSet()){
            if(lOption.getFile().getPath().toLowerCase().endsWith(CSV_EXTENSION) || lOption.getFile().getPath().toLowerCase().endsWith(XML_EXTENSION)){
View Full Code Here

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

     *
     * @param pdfFile
     * @return a PdfFile
     */
    public static PdfFile getPdfFile(jcmdline.dto.PdfFile pdfFile) {
        return new PdfFile(pdfFile.getFile(), pdfFile.getPassword());
    }
View Full Code Here

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

     * @return a PdfFile[]
     */
    public static PdfFile[] getPdfFiles(jcmdline.dto.PdfFile[] pdfFiles) {
        ArrayList retVal = new ArrayList();
        for (int i = 0; i < pdfFiles.length; i++) {
            retVal.add(new PdfFile(pdfFiles[i].getFile(), pdfFiles[i].getPassword()));
        }
        return (PdfFile[]) retVal.toArray(new PdfFile[pdfFiles.length]);
    }
View Full Code Here

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

            // read file
            while ((temp = bufferReader.readLine()) != null) {
                String[] tmpContent = temp.split(",");
                for (int i = 0; i < tmpContent.length; i++) {
                    if (tmpContent[i].trim().length() > 0) {
                        retVal.add(new PdfFile(tmpContent[i], null));
                    }
                }
            }
            bufferReader.close();
        } catch (IOException e) {
View Full Code Here

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

     *            file parent path or null
     * @return a PdfFile object given a file node
     * @throws Exception
     */
    private PdfFile getPdfFileFromNode(Node pdfNode, String parentPath) throws Exception {
        PdfFile retVal = null;
        String pwd = null;
        String fileName = null;
        // get filename
        Node fileNode = pdfNode.selectSingleNode("@value");
        if (fileNode != null) {
            fileName = fileNode.getText().trim();
        } else {
            throw new ConcatException(ConcatException.ERR_READING_CSV_OR_XML, new String[] { "Empty file name." });
        }
        // get pwd value
        Node pwdNode = pdfNode.selectSingleNode("@password");
        if (pwdNode != null) {
            pwd = pwdNode.getText();
        }
        if (parentPath != null && parentPath.length() > 0) {
            retVal = new PdfFile(new File(parentPath, fileName), pwd);
        } else {
            retVal = new PdfFile(fileName, pwd);
        }
        return retVal;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.