Package org.apache.pdfbox.util

Examples of org.apache.pdfbox.util.PDFMergerUtility


        if ( args.length - firstFileArgPos < 3 )
        {
            usage();
        }

        PDFMergerUtility merger = new PDFMergerUtility();
        for( int i=firstFileArgPos; i<args.length-1; i++ )
        {
            sourceFileName = args[i];
            merger.addSource(sourceFileName);
        }

        destinationFileName = args[args.length-1];

        merger.setDestinationFileName(destinationFileName);

        if (nonSeq)
        {
            merger.mergeDocumentsNonSeq(null);
        }
        else
        {
            merger.mergeDocuments();
        }
    }
View Full Code Here


        if ( args.length < 3 )
        {
            usage();
        }

        PDFMergerUtility merger = new PDFMergerUtility();
        for( int i=0; i<args.length-1; i++ )
        {
            sourceFileName = args[i];
            merger.addSource(sourceFileName);
        }

        destinationFileName = args[args.length-1];

        merger.setDestinationFileName(destinationFileName);

        merger.mergeDocuments();
    }
View Full Code Here

        endPage = pageCount;
      }

      PDDocument destination = list.get(start);

      PDFMergerUtility merger = new PDFMergerUtility();
      for (int i = startPage + 1; i < endPage; i++) {
        PDDocument tmpDocument = list.get(i);
        merger.appendDocument(destination, tmpDocument);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      COSWriter writer = new COSWriter(bos);
View Full Code Here

  @Override
  public InputStream merge(final InputStream[] sources) throws IOException {
    try {
      Assert.notEmpty(sources, "sources");

      PDFMergerUtility merger = new PDFMergerUtility();
      for (InputStream source : sources) {
        merger.addSource(source);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      merger.setDestinationStream(bos);
      merger.mergeDocuments();

      ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());

      return bis;
    } catch (COSVisitorException e) {
View Full Code Here

        if ( args.length < 3 )
        {
            usage();
        }

        PDFMergerUtility merger = new PDFMergerUtility();
        for( int i=0; i<args.length-1; i++ )
        {
            sourceFileName = args[i];
            merger.addSource(sourceFileName);
        }

        destinationFileName = args[args.length-1];

        merger.setDestinationFileName(destinationFileName);

        merger.mergeDocuments();
    }
View Full Code Here

        endPage = pageCount;
      }

      PDDocument destination = list.get(startPage);

      PDFMergerUtility merger = new PDFMergerUtility();
      for (int i = startPage + 1; i < endPage; i++) {
        PDDocument tmpDocument = list.get(i);
        merger.appendDocument(destination, tmpDocument);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      COSWriter writer = new COSWriter(bos);
View Full Code Here

  @Override
  public InputStream merge(final InputStream[] sources) {
    try {
      Assert.notEmpty(sources, "sources");

      PDFMergerUtility merger = new PDFMergerUtility();
      for (InputStream source : sources) {
        merger.addSource(source);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      merger.setDestinationStream(bos);
      merger.mergeDocuments();

      ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());

      return bis;
    } catch (IOException e) {
View Full Code Here

        endPage = pageCount;
      }

      PDDocument destination = list.get(startPage);

      PDFMergerUtility merger = new PDFMergerUtility();
      for (int i = startPage + 1; i < endPage; i++) {
        PDDocument tmpDocument = list.get(i);
        merger.appendDocument(destination, tmpDocument);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      COSWriter writer = new COSWriter(bos);
View Full Code Here

        collection = Arrays.toList(sources);
      } else if (sources instanceof Collection) {
        collection = (Collection<Object>) sources;
      }

      PDFMergerUtility merger = new PDFMergerUtility();
      for (Object source : collection) {
        InputStream inputStream = PDFBox.toInputStream(source);
        merger.addSource(inputStream);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      merger.setDestinationStream(bos);
      merger.mergeDocuments();

      ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());

      return new DocumentOutput(bis);
    } catch (IOException e) {
View Full Code Here

        endPage = pageCount;
      }

      PDDocument destination = list.get(startPage);

      PDFMergerUtility merger = new PDFMergerUtility();
      for (int i = startPage + 1; i < endPage; i++) {
        PDDocument tmpDocument = list.get(i);
        merger.appendDocument(destination, tmpDocument);
      }

      ByteArrayOutputStream bos = new ByteArrayOutputStream();

      COSWriter writer = new COSWriter(bos);
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.util.PDFMergerUtility

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.