PDF Clown
0.1.2

org.pdfclown.tools
Class PageManager

java.lang.Object
  extended by org.pdfclown.tools.PageManager

public final class PageManager
extends Object

Tool for page management.

Since:
0.0.6
Version:
0.1.2, 12/28/12
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

Constructor Summary
PageManager()
           
PageManager(Document document)
           
 
Method Summary
 void add(Collection<Page> pages)
          Appends a collection of pages to the end of the document.
 void add(Document document)
          Appends a document to the end of the document.
 void add(int index, Collection<Page> pages)
          Inserts a collection of pages at the specified position in the document.
 void add(int index, Document document)
          Inserts a document at the specified position in the document.
 Document extract(int startIndex, int endIndex)
          Extracts a page range from the document.
 Document getDocument()
          Gets the document being managed.
static long getSize(Page page)
          Gets the data size of the specified page expressed in bytes.
static long getSize(Page page, Set<PdfReference> visitedReferences)
          Gets the data size of the specified page expressed in bytes.
 void move(int startIndex, int endIndex, int targetIndex)
          Moves a page range to a target position within the document.
 void remove(int startIndex, int endIndex)
          Removes a page range from the document.
 void setDocument(Document value)
          Sets the document to manipulate.
 List<Document> split()
          Bursts the document into single-page documents.
 List<Document> split(int... indexes)
          Splits the document into multiple subdocuments delimited by the specified page indexes.
 List<Document> split(long maxDataSize)
          Splits the document into multiple subdocuments on maximum file size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageManager

public PageManager()

PageManager

public PageManager(Document document)
Method Detail

getSize

public static long getSize(Page page)
Gets the data size of the specified page expressed in bytes.

Parameters:
page - Page whose data size has to be calculated.

getSize

public static long getSize(Page page,
                           Set<PdfReference> visitedReferences)
Gets the data size of the specified page expressed in bytes.

Parameters:
page - Page whose data size has to be calculated.
visitedReferences - References to data objects excluded from calculation. This set is useful, for example, to avoid recalculating the data size of shared resources. During the operation, this set is populated with references to visited data objects.

add

public void add(Document document)
Appends a document to the end of the document.

Parameters:
document - Document to be added.

add

public void add(int index,
                Document document)
Inserts a document at the specified position in the document.

Parameters:
index - Position at which the document has to be inserted.
document - Document to be inserted.

add

public void add(Collection<Page> pages)
Appends a collection of pages to the end of the document.

Parameters:
pages - Pages to be added.

add

public void add(int index,
                Collection<Page> pages)
Inserts a collection of pages at the specified position in the document.

Parameters:
index - Position at which the pages have to be inserted.
pages - Pages to be inserted.

extract

public Document extract(int startIndex,
                        int endIndex)
Extracts a page range from the document.

Parameters:
startIndex - The beginning index, inclusive.
endIndex - The ending index, exclusive.
Returns:
Extracted page range.

move

public void move(int startIndex,
                 int endIndex,
                 int targetIndex)
Moves a page range to a target position within the document.

Parameters:
startIndex - The beginning index, inclusive.
endIndex - The ending index, exclusive.
targetIndex - The target index.

getDocument

public Document getDocument()
Gets the document being managed.


remove

public void remove(int startIndex,
                   int endIndex)
Removes a page range from the document.

Parameters:
startIndex - The beginning index, inclusive.
endIndex - The ending index, exclusive.

setDocument

public void setDocument(Document value)
Sets the document to manipulate.


split

public List<Document> split()
Bursts the document into single-page documents.

Returns:
Split subdocuments.

split

public List<Document> split(int... indexes)
Splits the document into multiple subdocuments delimited by the specified page indexes.

Parameters:
indexes - Split page indexes.
Returns:
Split subdocuments.

split

public List<Document> split(long maxDataSize)
Splits the document into multiple subdocuments on maximum file size.

Parameters:
maxDataSize - Maximum data size (expressed in bytes) of target files. Note that resulting files may be a little bit larger than this value, as file data include (along with actual page data) some extra structures such as cross reference tables.
Returns:
Split documents.

PDF Clown
0.1.2

Project home page

Copyright © 2006-2013 Stefano Chizzolini. Some Rights Reserved.
This documentation is available under the terms of the GNU Free Documentation License.