Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray


      if (c1 == 'B' && c2 == 'M') {
        return  BmpImage.getImage(url);
      }
      if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
          || (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
        RandomAccessFileOrArray ra = null;
        try {
          if (url.getProtocol().equals("file")) {
            String file = url.getFile();
                        file = Utilities.unEscapeURL(file);
            ra = new RandomAccessFileOrArray(file);
          } else
            ra = new RandomAccessFileOrArray(url);
          Image img = TiffImage.getTiffImage(ra, 1);
          img.url = url;
          return img;
        } finally {
          if (ra != null)
            ra.close();
        }

      }
      throw new IOException(url.toString()
          + " is not a recognized imageformat.");
View Full Code Here


      if (c1 == 'B' && c2 == 'M') {
        return BmpImage.getImage(imgb);
      }
      if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
          || (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
        RandomAccessFileOrArray ra = null;
        try {
          ra = new RandomAccessFileOrArray(imgb);
          Image img = TiffImage.getTiffImage(ra, 1);
                    if (img.getOriginalData() == null)
                        img.setOriginalData(imgb);
          return img;
        } finally {
          if (ra != null)
            ra.close();
        }

      }
      throw new IOException(
          "The byte array is not a recognized imageformat.");
View Full Code Here

                System.out.println("==============Page " + pageNum + "====================");
                System.out.println("- - - - - Dictionary - - - - - -");
                PdfDictionary pageDictionary = reader.getPageN(pageNum);
                System.out.println(getDictionaryDetail(pageDictionary));
                System.out.println("- - - - - Content Stream - - - - - -");
                RandomAccessFileOrArray f = reader.getSafeFile();
               
                byte[] contentBytes = reader.getPageContent(pageNum, f);
                f.close();

               
               
                InputStream is = new ByteArrayInputStream(contentBytes);
                int ch;
View Full Code Here

    if ((parsedCommand != null) && (parsedCommand instanceof DocumentInfoParsedCommand)) {
      DocumentInfoParsedCommand inputCommand = (DocumentInfoParsedCommand) parsedCommand;
      setPercentageOfWorkDone(0);
      try {
        File tmpFile = FileUtility.generateTmpFile(inputCommand.getOutputFile());
        pdfReader = new PdfReader(new RandomAccessFileOrArray(inputCommand.getInputFile().getFile().getAbsolutePath()), inputCommand
            .getInputFile().getPasswordBytes());
        pdfReader.removeUnusedObjects();
        pdfReader.consolidateNamedDestinations();

        // version
View Full Code Here

              encType = PdfWriter.STANDARD_ENCRYPTION_128;
            }

            prefixParser = new PrefixParser(inputCommand.getOutputFilesPrefix(), fileList[i].getFile().getName());
            File tmpFile = FileUtility.generateTmpFile(inputCommand.getOutputFile());
            pdfReader = new PdfReader(new RandomAccessFileOrArray(fileList[i].getFile().getAbsolutePath()), fileList[i]
                .getPasswordBytes());
            pdfReader.removeUnusedObjects();
            pdfReader.consolidateNamedDestinations();

            // version
View Full Code Here

        }
        for(int i = 0; i<fileList.length; i++){
          try{
            prefixParser = new PrefixParser(inputCommand.getOutputFilesPrefix(), fileList[i].getFile().getName());
            File tmpFile = FileUtility.generateTmpFile(inputCommand.getOutputFile());
            pdfReader = new PdfReader(new RandomAccessFileOrArray(fileList[i].getFile().getAbsolutePath()),fileList[i].getPasswordBytes());
            pdfReader.removeUnusedObjects();
            pdfReader.consolidateNamedDestinations();
           
            //version
            LOG.debug("Creating a new document.");
View Full Code Here

                        currentPageSelection = pageSelections[i].toLowerCase();
                    }

                    String[] selectionGroups = StringUtils.split(currentPageSelection, ",");

                    pdfReader = new PdfReader(new RandomAccessFileOrArray(fileList[i].getFile().getAbsolutePath()),
                            fileList[i].getPasswordBytes());
                    pdfReader.removeUnusedObjects();
                    pdfReader.consolidateNamedDestinations();
                    int pdfNumberOfPages = pdfReader.getNumberOfPages();
                    BookmarksProcessor bookmarkProcessor = new BookmarksProcessor(SimpleBookmark.getBookmark(pdfReader), pdfNumberOfPages);
View Full Code Here

      transitions = parseXmlInput(inputCommand.getInputXmlFile(), transitions);
      try{
        prefixParser = new PrefixParser(inputCommand.getOutputFilesPrefix(), inputCommand.getInputFile().getFile().getName());       
        File tmpFile = FileUtility.generateTmpFile(inputCommand.getOutputFile());
       
        pdfReader = new PdfReader(new RandomAccessFileOrArray(inputCommand.getInputFile().getFile().getAbsolutePath()),inputCommand.getInputFile().getPasswordBytes());
        pdfReader.removeUnusedObjects();
        pdfReader.consolidateNamedDestinations();
       
        //version
        LOG.debug("Creating a new document.");
View Full Code Here

          tableItem.setInputFile(fileToAdd);
          tableItem.setPassword(password);
          tableItem.setPageSelection(pageSelection);
            try{
                //fix 04/11/08 for memory usage
               pdfReader = new PdfReader(new RandomAccessFileOrArray(fileToAdd.getAbsolutePath()), (password != null)?password.getBytes():null);                 
                 tableItem.setEncrypted(pdfReader.isEncrypted());
                 tableItem.setFullPermission(pdfReader.isOpenedWithFullPermissions());
                 if(tableItem.isEncrypted()){
                   tableItem.setPermissions(getPermissionsVerbose(pdfReader.getPermissions()));
                   int cMode = pdfReader.getCryptoMode();
View Full Code Here

      if (c1 == 'B' && c2 == 'M') {
        return  BmpImage.getImage(url);
      }
      if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
          || (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
        RandomAccessFileOrArray ra = null;
        try {
          if (url.getProtocol().equals("file")) {
            String file = url.getFile();
                        file = Utilities.unEscapeURL(file);
            ra = new RandomAccessFileOrArray(file);
          } else
            ra = new RandomAccessFileOrArray(url);
          LwgImage img = TiffImage.getTiffImage(ra, 1);
          img.url = url;
          return img;
        } finally {
          if (ra != null)
            ra.close();
        }

      }
      if ( c1 == 0x97 && c2 == 'J' && c3 == 'B' && c4 == '2' &&
          c5 == '\r' && c6 == '\n' && c7 == 0x1a && c8 == '\n' ) {
        RandomAccessFileOrArray ra = null;
        try {
          if (url.getProtocol().equals("file")) {
            String file = url.getFile();
            file = Utilities.unEscapeURL(file);
                  ra = new RandomAccessFileOrArray(file);
          } else
            ra = new RandomAccessFileOrArray(url);
          LwgImage img = JBIG2Image.getJbig2Image(ra, 1);
          img.url = url;
          return img;
        } finally {
            if (ra != null)
              ra.close();
        }
      }
      throw new IOException(url.toString()
          + " is not a recognized imageformat.");
    } finally {
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.RandomAccessFileOrArray

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.