adams.core.io
Class ImagePdfProclet

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.core.io.AbstractPdfProclet
              extended by adams.core.io.ImagePdfProclet
All Implemented Interfaces:
Debuggable, Destroyable, OptionHandler, SizeOfHandler, Serializable

public class ImagePdfProclet
extends AbstractPdfProclet

Adds GIF, JPEG and PNG image files.

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to
    the console (0 = off).
    default: 0
    minimum: 0
 
-page-break-before (property: pageBreakBefore)
    If true, then a page-break is added before the content of the file is inserted.
 
-page-break-after (property: pageBreakAfter)
    If true, then a page-break is added after the content of the file is inserted.
 
-num-files <int> (property: numFilesPerPage)
    The number of files to put on a page before adding an automatic page break;
     use -1 for unlimited.
    default: -1
    minimum: -1
 
-add-filename (property: addFilename)
    Whether to add the file name before the actual file content as separate
    paragraph.
 
-font-filename <adams.core.io.PdfFont> (property: fontFilename)
    The font to use for printing the file name header.
    default: Helvetica-Bold-12
 
-color-filename <java.awt.Color> (property: colorFilename)
    The color to use for printing the file name header.
    default: #000000
 
-rotation <int> (property: rotation)
    The rotation in degrees.
    default: 0
    minimum: 0
    maximum: 360
 
-scale <double> (property: scale)
    The scaling factor for the image, ie, scaling it to the page dimensions;
    use 0 to turn scaling off.
    default: 1.0
    minimum: 0.0
    maximum: 1.0
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class adams.core.io.AbstractPdfProclet
AbstractPdfProclet.DocumentState
 
Field Summary
protected  int m_Rotation
          the degrees to rotate images.
protected  double m_Scale
          the percentage (0-1) to scale the images to.
 
Fields inherited from class adams.core.io.AbstractPdfProclet
m_AddFilename, m_ColorFilename, m_FontFilename, m_NumFilesPerPage, m_PageBreakAfter, m_PageBreakBefore, MATCH_ALL_EXTENSION
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
ImagePdfProclet()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  boolean doProcess(com.itextpdf.text.Document doc, AbstractPdfProclet.DocumentState state, File file)
          The actual processing of the document.
 BaseString[] getExtensions()
          Returns the extensions that the processor can process.
 int getRotation()
          Returns the degrees by which to rotate the images.
 double getScale()
          Returns the scale factor (0-1) for images based on the page size.
 String globalInfo()
          Returns a short description of the writer.
 String rotationTipText()
          Returns the tip text for this property.
 String scaleTipText()
          Returns the tip text for this property.
 void setRotation(int value)
          Sets the degrees to rotate the image by.
 void setScale(double value)
          Sets the scale factor (0-1) for images based on the page size.
 
Methods inherited from class adams.core.io.AbstractPdfProclet
addFilename, addFilenameTipText, canProcess, colorFilenameTipText, fontFilenameTipText, getAddFilename, getColorFilename, getFontFilename, getNumFilesPerPage, getPageBreakAfter, getPageBreakBefore, numFilesPerPageTipText, pageBreakAfterTipText, pageBreakBeforeTipText, postProcess, preProcess, process, setAddFilename, setColorFilename, setFontFilename, setNumFilesPerPage, setPageBreakAfter, setPageBreakBefore
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, destroy, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, reset, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Rotation

protected int m_Rotation
the degrees to rotate images.


m_Scale

protected double m_Scale
the percentage (0-1) to scale the images to.

Constructor Detail

ImagePdfProclet

public ImagePdfProclet()
Method Detail

globalInfo

public String globalInfo()
Returns a short description of the writer.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description of the writer

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractPdfProclet

setRotation

public void setRotation(int value)
Sets the degrees to rotate the image by.

Parameters:
value - the degrees

getRotation

public int getRotation()
Returns the degrees by which to rotate the images.

Returns:
the degrees

rotationTipText

public String rotationTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setScale

public void setScale(double value)
Sets the scale factor (0-1) for images based on the page size.

Parameters:
value - the scale factor, 0 to turn off scaling

getScale

public double getScale()
Returns the scale factor (0-1) for images based on the page size.

Returns:
the scale factor

scaleTipText

public String scaleTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

getExtensions

public BaseString[] getExtensions()
Returns the extensions that the processor can process.

Specified by:
getExtensions in class AbstractPdfProclet
Returns:
the extensions (no dot)

doProcess

protected boolean doProcess(com.itextpdf.text.Document doc,
                            AbstractPdfProclet.DocumentState state,
                            File file)
                     throws Exception
The actual processing of the document.

Specified by:
doProcess in class AbstractPdfProclet
Parameters:
doc - the PDF document to add the file content to
state - the current document state
file - the file to add
Returns:
true if successfully added
Throws:
Exception - if something goes wrong


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.