org.sejda.impl.itext.component
Class PdfStamperHandler

java.lang.Object
  extended by org.sejda.impl.itext.component.PdfStamperHandler
All Implemented Interfaces:
Closeable

public final class PdfStamperHandler
extends Object
implements Closeable

Component responsible for handling operations related to a PdfStamper instance.

Author:
Andrea Vacondio

Constructor Summary
PdfStamperHandler(com.lowagie.text.pdf.PdfReader reader, File ouputFile, PdfVersion version)
          Creates a new instance initializing the inner PdfStamper instance.
 
Method Summary
 void addViewerPreferenceOnStamper(com.lowagie.text.pdf.PdfName key, com.lowagie.text.pdf.PdfObject value)
          adds the viewer preference to the stamper
 void close()
           
 com.lowagie.text.pdf.PdfStamper getStamper()
           
 void setCompressionOnStamper(boolean compress)
          Enables compression if compress is true
 void setCreatorOnStamper(com.lowagie.text.pdf.PdfReader reader)
          Adds the creator to the metadata taken from the reader and it sets it to the PdfStamper
 void setEncryptionOnStamper(int encryptionType, String userPassword, String ownerPassword, int permissions)
          Sets the encryption for this document delegating encryption to the stamper.
 void setMetadataOnStamper(HashMap<String,String> meta)
          Adds the creator to the metadata in input and it sets it to the PdfStamper
 void setTransitionOnStamper(Integer page, PdfPageTransition transition)
          Applies the given transition to the given page.
 void setViewerPreferencesOnStamper(int preferences)
          Sets the viewer preferences on the stamper
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PdfStamperHandler

public PdfStamperHandler(com.lowagie.text.pdf.PdfReader reader,
                         File ouputFile,
                         PdfVersion version)
                  throws TaskException
Creates a new instance initializing the inner PdfStamper instance.

Parameters:
reader - input reader
ouputFile - File to stamp on
version - version for the created stamper, if null the version number is taken from the input PdfReader
Throws:
TaskException - in case of error
Method Detail

setCompressionOnStamper

public void setCompressionOnStamper(boolean compress)
Enables compression if compress is true

Parameters:
compress -

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

setCreatorOnStamper

public void setCreatorOnStamper(com.lowagie.text.pdf.PdfReader reader)
Adds the creator to the metadata taken from the reader and it sets it to the PdfStamper

Parameters:
reader -

setMetadataOnStamper

public void setMetadataOnStamper(HashMap<String,String> meta)
Adds the creator to the metadata in input and it sets it to the PdfStamper

Parameters:
meta -

setEncryptionOnStamper

public void setEncryptionOnStamper(int encryptionType,
                                   String userPassword,
                                   String ownerPassword,
                                   int permissions)
                            throws TaskException
Sets the encryption for this document delegating encryption to the stamper.

Parameters:
encryptionType -
userPassword -
ownerPassword -
permissions -
Throws:
TaskException - wraps the DocumentException that can be thrown by the stamper
See Also:
PdfStamper.setEncryption(int, String, String, int)

setTransitionOnStamper

public void setTransitionOnStamper(Integer page,
                                   PdfPageTransition transition)
Applies the given transition to the given page.

Parameters:
page -
transition -

setViewerPreferencesOnStamper

public void setViewerPreferencesOnStamper(int preferences)
Sets the viewer preferences on the stamper

Parameters:
preferences -
See Also:
PdfStamper.setViewerPreferences(int)

addViewerPreferenceOnStamper

public void addViewerPreferenceOnStamper(com.lowagie.text.pdf.PdfName key,
                                         com.lowagie.text.pdf.PdfObject value)
adds the viewer preference to the stamper

Parameters:
key -
value -
See Also:
PdfStamper.addViewerPreference(PdfName, PdfObject)

getStamper

public com.lowagie.text.pdf.PdfStamper getStamper()
Returns:
the inner PdfStamper instance


Copyright © 2013 sejda. All Rights Reserved.