Examples of RandomAccessFileOrArray


Examples of com.itextpdf.text.pdf.RandomAccessFileOrArray

        resources.put(PdfName.XOBJECT, xobjects);
      }
      // parsing the content stream of the page
    PRStream stream = (PRStream)page.getAsStream(PdfName.CONTENTS);
    byte[] contentBytes = PdfReader.getStreamBytes(stream);
        PRTokeniser tokeniser = new PRTokeniser(new RandomAccessFileOrArray(RASFACTORY.createSource(contentBytes)));
        PdfContentParser ps = new PdfContentParser(tokeniser);
        ArrayList<PdfObject> operands = new ArrayList<PdfObject>();
        while (ps.parse(operands).size() > 0){
            PdfLiteral operator = (PdfLiteral)operands.get(operands.size() - 1);
            processOperator(operator, operands);
View Full Code Here

Examples of com.itextpdf.text.pdf.RandomAccessFileOrArray

      }
    }
      try {
        // parse the content stream
        byte[] contentBytes = PdfReader.getStreamBytes(stream);
            PRTokeniser tokeniser = new PRTokeniser(new RandomAccessFileOrArray(contentBytes));
            PdfContentParser ps = new PdfContentParser(tokeniser);
            ArrayList<PdfObject> operands = new ArrayList<PdfObject>();
            while (ps.parse(operands).size() > 0){
                PdfLiteral operator = (PdfLiteral)operands.get(operands.size() - 1);
                processOperator(this, operator, operands);
View Full Code Here

Examples of com.itextpdf.text.pdf.RandomAccessFileOrArray

  private void createPdfDocumentFileFromTIFF(File tiffFile, File pdfFile) throws Exception {
    Document document = new Document(PageSize.A4, 0.0f, 0.0f, 0.0f, 0.0f);
    PdfWriter.getInstance(document, new FileOutputStream(pdfFile));
    document.open();
    RandomAccessFileOrArray ra = new RandomAccessFileOrArray(tiffFile.getCanonicalPath());
    int pageCount = TiffImage.getNumberOfPages(ra);
    for (int i = 0; i < pageCount; ++i) {
      Image img = TiffImage.getTiffImage(ra, i + 1);
      if (img != null) {
        if (i != 0) {
          document.newPage();
        }
        if (img.getWidth() > PageSize.A4.getWidth() || img.getHeight() > PageSize.A4.getHeight()) {
          img.scaleToFit(PageSize.A4.getWidth(), PageSize.A4.getHeight());
        }
        document.add(img);
      }
    }
    ra.close();
    document.close();
  }
View Full Code Here

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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

      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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

                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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

    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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

              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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

        }
        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

Examples of com.lowagie.text.pdf.RandomAccessFileOrArray

                        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
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.