Class Image
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,PdfProclet,PdfProcletWithAbsolutePosition,PdfProcletWithFilenameOutput,PdfProcletWithOptionalAbsolutePosition,PdfProcletWithPageBreaks,Serializable
public class Image extends AbstractPdfProcletWithPageBreaks implements PdfProcletWithOptionalAbsolutePosition
Adds GIF, JPEG and PNG image files.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-regexp-filename <adams.core.base.BaseRegExp> (property: regExpFilename) The regular expression that the filename must match. default: .* more: https://docs.oracle.com/javase/tutorial/essential/regex/ https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html
-add-filename <boolean> (property: addFilename) Whether to add the file name before the actual file content as separate paragraph. default: false
-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
-page-break-before <boolean> (property: pageBreakBefore) If true, then a page-break is added before the content of the file is inserted. default: false
-page-break-after <boolean> (property: pageBreakAfter) If true, then a page-break is added after the content of the file is inserted. default: false
-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
-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
-use-absolute-position <boolean> (property: useAbsolutePosition) If enabled, the absolute position is used (from bottom-left corner). default: false
-x <float> (property: X) The absolute X position. default: 0.0 minimum: 0.0
-y <float> (property: Y) The absolute Y position. default: 0.0 minimum: 0.0
-scaling-type <SCALE_TO_FIT|SCALE_PERCENT> (property: scalingType) The type of scaling to use. default: SCALE_TO_FIT
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImage.ScalingTypeThe type of scaling to use.
-
Field Summary
Fields Modifier and Type Field Description protected intm_Rotationthe degrees to rotate images.protected doublem_Scalethe percentage (0-1) to scale the images to.protected Image.ScalingTypem_ScalingTypethe type of scaling to use.protected booleanm_UseAbsolutePositionwhether to use absolute position.protected floatm_Xthe absolute X position.protected floatm_Ythe absolute Y position.-
Fields inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProcletWithPageBreaks
m_NumFilesPerPage, m_PageBreakAfter, m_PageBreakBefore
-
Fields inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProcletWithFilenameOutput
m_AddFilename, m_ColorFilename, m_FontFilename
-
Fields inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProclet
m_RegExpFilename, MATCH_ALL_EXTENSION
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Image()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanProcess(PDFGenerator generator, Object obj)Whether the processor can handle this particular object.voiddefineOptions()Adds options to the internal list of options.protected booleandoProcess(PDFGenerator generator, BufferedImage img)The actual processing of the document.protected booleandoProcess(PDFGenerator generator, File file)The actual processing of the document.protected booleandoProcess(PDFGenerator generator, Object obj)The actual processing of the document.BaseString[]getExtensions()Returns the extensions that the processor can process.intgetRotation()Returns the degrees by which to rotate the images.doublegetScale()Returns the scale factor (0-1) for images based on the page size.Image.ScalingTypegetScalingType()Returns the type of scaling to use.booleangetUseAbsolutePosition()Returns whether absolute positioning is used (from bottom-left corner).floatgetX()Returns the absolute X position.floatgetY()Returns the absolute Y position.StringglobalInfo()Returns a short description of the writer.StringrotationTipText()Returns the tip text for this property.StringscaleTipText()Returns the tip text for this property.StringscalingTypeTipText()Returns the tip text for this property.voidsetRotation(int value)Sets the degrees to rotate the image by.voidsetScale(double value)Sets the scale factor (0-1) for images based on the page size.voidsetScalingType(Image.ScalingType value)Sets the type of scaling to use.voidsetUseAbsolutePosition(boolean value)Sets whether to use absolute positioning (from bottom-left corner).voidsetX(float value)Sets the absolute X position.voidsetY(float value)Sets the absolute Y position.StringuseAbsolutePositionTipText()Returns the tip text for this property.StringXTipText()Returns the tip text for this property.StringYTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProcletWithPageBreaks
getNumFilesPerPage, getPageBreakAfter, getPageBreakBefore, numFilesPerPageTipText, pageBreakAfterTipText, pageBreakBeforeTipText, postProcess, postProcess, preProcess, preProcess, setNumFilesPerPage, setPageBreakAfter, setPageBreakBefore
-
Methods inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProcletWithFilenameOutput
addFilename, addFilenameTipText, colorFilenameTipText, fontFilenameTipText, getAddFilename, getColorFilename, getFontFilename, setAddFilename, setColorFilename, setFontFilename
-
Methods inherited from class adams.flow.transformer.pdfproclet.AbstractPdfProclet
addColumnTextAt, addElement, canProcess, getRegExpFilename, process, process, regExpFilenameTipText, setRegExpFilename
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.flow.transformer.pdfproclet.PdfProclet
canProcess, getRegExpFilename, process, process, regExpFilenameTipText, setRegExpFilename
-
-
-
-
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.
-
m_UseAbsolutePosition
protected boolean m_UseAbsolutePosition
whether to use absolute position.
-
m_X
protected float m_X
the absolute X position.
-
m_Y
protected float m_Y
the absolute Y position.
-
m_ScalingType
protected Image.ScalingType m_ScalingType
the type of scaling to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a short description of the writer.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description of the writer
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractPdfProcletWithPageBreaks
-
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.
-
setUseAbsolutePosition
public void setUseAbsolutePosition(boolean value)
Sets whether to use absolute positioning (from bottom-left corner).- Specified by:
setUseAbsolutePositionin interfacePdfProcletWithOptionalAbsolutePosition- Parameters:
value- true if absolute
-
getUseAbsolutePosition
public boolean getUseAbsolutePosition()
Returns whether absolute positioning is used (from bottom-left corner).- Specified by:
getUseAbsolutePositionin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- true if absolute
-
useAbsolutePositionTipText
public String useAbsolutePositionTipText()
Returns the tip text for this property.- Specified by:
useAbsolutePositionTipTextin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setX
public void setX(float value)
Sets the absolute X position.- Specified by:
setXin interfacePdfProcletWithAbsolutePosition- Specified by:
setXin interfacePdfProcletWithOptionalAbsolutePosition- Parameters:
value- the X position
-
getX
public float getX()
Returns the absolute X position.- Specified by:
getXin interfacePdfProcletWithAbsolutePosition- Specified by:
getXin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- the X position
-
XTipText
public String XTipText()
Returns the tip text for this property.- Specified by:
XTipTextin interfacePdfProcletWithAbsolutePosition- Specified by:
XTipTextin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(float value)
Sets the absolute Y position.- Specified by:
setYin interfacePdfProcletWithAbsolutePosition- Specified by:
setYin interfacePdfProcletWithOptionalAbsolutePosition- Parameters:
value- the Y position
-
getY
public float getY()
Returns the absolute Y position.- Specified by:
getYin interfacePdfProcletWithAbsolutePosition- Specified by:
getYin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- the Y position
-
YTipText
public String YTipText()
Returns the tip text for this property.- Specified by:
YTipTextin interfacePdfProcletWithAbsolutePosition- Specified by:
YTipTextin interfacePdfProcletWithOptionalAbsolutePosition- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setScalingType
public void setScalingType(Image.ScalingType value)
Sets the type of scaling to use.- Parameters:
value- the type
-
getScalingType
public Image.ScalingType getScalingType()
Returns the type of scaling to use.- Returns:
- the type
-
scalingTypeTipText
public String scalingTypeTipText()
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:
getExtensionsin interfacePdfProclet- Specified by:
getExtensionsin classAbstractPdfProclet- Returns:
- the extensions (no dot)
-
doProcess
protected boolean doProcess(PDFGenerator generator, BufferedImage img) throws Exception
The actual processing of the document.- Parameters:
generator- the contextimg- the image to add- Returns:
- true if successfully added
- Throws:
Exception- if something goes wrong
-
doProcess
protected boolean doProcess(PDFGenerator generator, File file) throws Exception
The actual processing of the document.- Specified by:
doProcessin classAbstractPdfProclet- Parameters:
generator- the contextfile- the file to add- Returns:
- true if successfully added
- Throws:
Exception- if something goes wrong
-
canProcess
public boolean canProcess(PDFGenerator generator, Object obj)
Whether the processor can handle this particular object.- Specified by:
canProcessin interfacePdfProclet- Specified by:
canProcessin classAbstractPdfProclet- Parameters:
generator- the contextobj- the object to check- Returns:
- true if the object can be handled
-
doProcess
protected boolean doProcess(PDFGenerator generator, Object obj) throws Exception
The actual processing of the document.- Specified by:
doProcessin classAbstractPdfProclet- Parameters:
generator- the contextobj- the object to add- Returns:
- true if successfully added
- Throws:
Exception- if something goes wrong
-
-