public class DocumentHandler extends Object
Handler for manipulating documents.
Constructor and Description |
---|
DocumentHandler() |
Modifier and Type | Method and Description |
---|---|
DocumentResult |
addPassword(InputStream documentStream,
AddPasswordOptions addPasswordOptions)
Protects document of known format with password.
|
DocumentResult |
addPassword(InputStream documentStream,
String password)
Protects document of unknown format with password.
|
DocumentResult |
changeOrientation(InputStream documentStream,
int mode,
int[] pageNumbers)
Makes new document from document of unknown format and applis new orientation mode for specified pages.
|
DocumentResult |
changeOrientation(InputStream documentStream,
OrientationOptions orientationOptions)
Makes new document from document of known format and applies new orientation mode for specified pages.
|
Map<String,Long> |
getSupportedFormats()
Get list of supported document formats.
|
boolean |
isPasswordSet(InputStream documentStream)
Checks whether document of unknown format is password protected.
|
boolean |
isPasswordSet(InputStream documentStream,
long fileFormat)
Checks whether document of known format is password protected.
|
DocumentResult |
join(List<JoinItem> joinItems)
Joins multiple documents of known format into the one document.
|
DocumentResult |
joinStream(List<InputStream> documentStreams)
Joins multiple document streams of unknown format into resultant document.
|
DocumentResult |
movePage(InputStream documentStream,
int pageNumberToMove,
int newPageNumber)
Moves page to a new position within document of unknown format.
|
DocumentResult |
movePage(InputStream documentStream,
MoveOptions moveOptions)
Moves page to a new position within document of known format.
|
DocumentResult |
removePages(InputStream documentStream,
int startPageNumber,
int endPageNumber,
int mode)
Removes pages from document of unknown format.
|
DocumentResult |
removePages(InputStream documentStream,
List<Integer> pageNumbers)
Removes pages from document of unknown format.
|
DocumentResult |
removePages(InputStream documentStream,
com.groupdocs.merger.domain.options.RemovePagesOptions removePagesOptions)
Removes pages from document of known format.
|
DocumentResult |
removePassword(InputStream documentStream,
RemovePasswordOptions options)
Removes password from document of known format.
|
DocumentResult |
removePassword(InputStream documentStream,
String password)
Removes password from document of unknown format.
|
DocumentResult |
rotatePages(InputStream documentStream,
int mode)
Rotate pages in document of unknown format.
|
DocumentResult |
rotatePages(InputStream documentStream,
com.groupdocs.merger.domain.options.RotateOptions rotateOptions)
Rotate pages in document of known format.
|
MultiDocumentResult |
split(InputStream documentStream,
SplitOptions splitOptions)
Splits single document of known format to multiple documents.
|
DocumentResult |
swapPages(InputStream documentStream,
int firstPageNumber,
int secondPageNumber)
Swaps two pages within document of unknown format.
|
DocumentResult |
swapPages(InputStream documentStream,
SwapOptions options)
Swaps two pages within document of known format.
|
DocumentResult |
trim(InputStream documentStream,
TrimOptions trimOptions)
Makes new document with some pages from source document of known format.
|
DocumentResult |
updatePassword(InputStream documentStream,
String oldPassword,
String newPassword)
Updates existing password for document of unknown format.
|
DocumentResult |
updatePassword(InputStream documentStream,
UpdatePasswordOptions options)
Updates existing password for document of known format.
|
public DocumentResult addPassword(InputStream documentStream, AddPasswordOptions addPasswordOptions) throws Exception
Protects document of known format with password. Source document file format must be specified explicitly.
documentStream
- Unprotected document.addPasswordOptions
- The options for specifying password and document file format.Exception
public DocumentResult addPassword(InputStream documentStream, String password) throws Exception
Protects document of unknown format with password. Source document file format will be detected on the fly.
documentStream
- Unprotected document.password
- Password to be set.Exception
public final DocumentResult changeOrientation(InputStream documentStream, int mode, int[] pageNumbers) throws Exception
Makes new document from document of unknown format and applis new orientation mode for specified pages.
documentStream
- The document stream.mode
- Mode of page orientation.pageNumbers
- Array of page numbers.Exception
public final DocumentResult changeOrientation(InputStream documentStream, OrientationOptions orientationOptions) throws Exception
Makes new document from document of known format and applies new orientation mode for specified pages.
documentStream
- The document stream.orientationOptions
- The change orientation options.Exception
public final Map<String,Long> getSupportedFormats()
Get list of supported document formats.
public boolean isPasswordSet(InputStream documentStream) throws Exception
Checks whether document of unknown format is password protected. Source document file format will be detected on the fly.
documentStream
- The document stream.Exception
public boolean isPasswordSet(InputStream documentStream, long fileFormat) throws Exception
Checks whether document of known format is password protected. Source document file format must be specified explicitly.
documentStream
- The document stream.fileFormat
- The file format.Exception
public DocumentResult join(List<JoinItem> joinItems) throws Exception
Joins multiple documents of known format into the one document. Each document format should be specified explicitly via JoinItem properties.
joinItems
- The documents to join.Exception
public DocumentResult joinStream(List<InputStream> documentStreams) throws Exception
Joins multiple document streams of unknown format into resultant document. Document format will be detected on the fly.
documentStreams
- The document streams to join.Exception
public DocumentResult movePage(InputStream documentStream, int pageNumberToMove, int newPageNumber) throws Exception
Moves page to a new position within document of unknown format.
documentStream
- The document stream.pageNumberToMove
- The page number to move.newPageNumber
- The new page number.Exception
public DocumentResult movePage(InputStream documentStream, MoveOptions moveOptions) throws Exception
Moves page to a new position within document of known format.
documentStream
- The document stream.moveOptions
- The move options.Exception
public final DocumentResult removePages(InputStream documentStream, int startPageNumber, int endPageNumber, int mode) throws Exception
Removes pages from document of unknown format.
documentStream
- The document stream.startPageNumber
- The start page number.endPageNumber
- The end page number.mode
- The page range mode.Exception
public DocumentResult removePages(InputStream documentStream, List<Integer> pageNumbers) throws Exception
Removes pages from document of unknown format.
documentStream
- The document stream.pageNumbers
- The list of page numbers to be removed.Exception
public final DocumentResult removePages(InputStream documentStream, com.groupdocs.merger.domain.options.RemovePagesOptions removePagesOptions) throws Exception
Removes pages from document of known format.
documentStream
- The document stream.removePagesOptions
- The options for specifying document format and numbers of pages to be removed.Exception
public DocumentResult removePassword(InputStream documentStream, RemovePasswordOptions options) throws Exception
Removes password from document of known format. Source document file format must be specified explicitly.
documentStream
- The document stream.options
- The options for specifying document file format and current password.Exception
public DocumentResult removePassword(InputStream documentStream, String password) throws Exception
Removes password from document of unknown format. Source document file format will be detected on the fly.
documentStream
- The document stream.password
- The current document password.Exception
public final DocumentResult rotatePages(InputStream documentStream, int mode) throws Exception
Rotate pages in document of unknown format.
documentStream
- Not password protected document stream.mode
- Rotate mode RotateMode
Exception
public final DocumentResult rotatePages(InputStream documentStream, com.groupdocs.merger.domain.options.RotateOptions rotateOptions) throws Exception
Rotate pages in document of known format.
documentStream
- The document stream.rotateOptions
- The options for rotating.Exception
public MultiDocumentResult split(InputStream documentStream, SplitOptions splitOptions) throws Exception
Splits single document of known format to multiple documents.
documentStream
- The document stream.splitOptions
- The split options.Exception
public DocumentResult swapPages(InputStream documentStream, int firstPageNumber, int secondPageNumber) throws Exception
Swaps two pages within document of unknown format.
documentStream
- The document stream.firstPageNumber
- The first page to swap.secondPageNumber
- The second page to swap.Exception
public DocumentResult swapPages(InputStream documentStream, SwapOptions options) throws Exception
Swaps two pages within document of known format.
documentStream
- The document stream.options
- The swap options.Exception
public DocumentResult trim(InputStream documentStream, TrimOptions trimOptions) throws Exception
Makes new document with some pages from source document of known format.
documentStream
- The document stream.trimOptions
- The trim options.Exception
public DocumentResult updatePassword(InputStream documentStream, String oldPassword, String newPassword) throws Exception
Updates existing password for document of unknown format. Source document file format will be detected on the fly.
documentStream
- The document stream.oldPassword
- The current document password.newPassword
- The new document password.Exception
public DocumentResult updatePassword(InputStream documentStream, UpdatePasswordOptions options) throws Exception
Updates existing password for document of known format. Source document file format must be specified explicitly.
documentStream
- The document stream.options
- The options for specifying document file format and current/new passwords.Exception
Copyright © 2019. All rights reserved.