org.alfresco.repo.content.transform
Class TextToPdfContentTransformer

java.lang.Object
  extended by org.alfresco.repo.content.transform.ContentTransformerHelper
      extended by org.alfresco.repo.content.transform.AbstractContentTransformerLimits
          extended by org.alfresco.repo.content.transform.AbstractContentTransformer2
              extended by org.alfresco.repo.content.transform.TextToPdfContentTransformer
All Implemented Interfaces:
ContentWorker, ContentTransformer, org.springframework.beans.factory.BeanNameAware

public class TextToPdfContentTransformer
extends AbstractContentTransformer2

Makes use of the PDFBox library's TextToPDF utility.

Since:
2.1.0

Field Summary
 
Fields inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
transformerDebug
 
Constructor Summary
TextToPdfContentTransformer()
           
 
Method Summary
protected  java.io.InputStreamReader buildReader(java.io.InputStream is, java.lang.String encoding, java.lang.String node)
           
 boolean isTransformable(java.lang.String sourceMimetype, long sourceSize, java.lang.String targetMimetype, TransformationOptions options)
          Only supports Text to PDF
 boolean isTransformable(java.lang.String sourceMimetype, java.lang.String targetMimetype, TransformationOptions options)
          Deprecated. This method should no longer be called as the overloaded method that calls it has the overridden.
 void setFontSize(int fontSize)
           
 void setStandardFont(java.lang.String fontName)
           
 void setTrueTypeFont(java.lang.String fontName)
           
protected  void transformInternal(org.alfresco.service.cmr.repository.ContentReader reader, org.alfresco.service.cmr.repository.ContentWriter writer, TransformationOptions options)
          Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.
 
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2
checkTransformable, getTransformationTime, recordTime, register, setRegistry, toString, transform, transform, transform
 
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformerLimits
getBeanName, getLimits, getLimits, getLimits, getMaxPages, getMaxSourceSizeKBytes, getMimetypeLimits, getPageLimit, getReadLimitKBytes, getReadLimitTimeMs, getTimeoutMs, isPageLimitSupported, isTransformableSize, setBeanName, setLimits, setMaxPages, setMaxSourceSizeKBytes, setMimetypeLimits, setPageLimit, setPageLimitsSuported, setReaderLimits, setReadLimitKBytes, setReadLimitTimeMs, setTimeoutMs, setTransformerDebug
 
Methods inherited from class org.alfresco.repo.content.transform.ContentTransformerHelper
getMimetype, getMimetypeService, isExplicitTransformation, setExplicitTransformations, setMimetypeService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.alfresco.repo.content.transform.ContentTransformer
isExplicitTransformation
 

Constructor Detail

TextToPdfContentTransformer

public TextToPdfContentTransformer()
Method Detail

setStandardFont

public void setStandardFont(java.lang.String fontName)

setTrueTypeFont

public void setTrueTypeFont(java.lang.String fontName)

setFontSize

public void setFontSize(int fontSize)

isTransformable

public boolean isTransformable(java.lang.String sourceMimetype,
                               long sourceSize,
                               java.lang.String targetMimetype,
                               TransformationOptions options)
Only supports Text to PDF

Specified by:
isTransformable in interface ContentTransformer
Overrides:
isTransformable in class AbstractContentTransformerLimits
Parameters:
sourceMimetype - the source mimetype
sourceSize - the size (bytes) of the source. If negative it is unknown.
targetMimetype - the target mimetype
options - the transformation options
Returns:
boolean true if this content transformer can satify the mimetypes and options specified, false otherwise

isTransformable

public boolean isTransformable(java.lang.String sourceMimetype,
                               java.lang.String targetMimetype,
                               TransformationOptions options)
Deprecated. This method should no longer be called as the overloaded method that calls it has the overridden.


transformInternal

protected void transformInternal(org.alfresco.service.cmr.repository.ContentReader reader,
                                 org.alfresco.service.cmr.repository.ContentWriter writer,
                                 TransformationOptions options)
                          throws java.lang.Exception
Description copied from class: AbstractContentTransformer2
Method to be implemented by subclasses wishing to make use of the common infrastructural code provided by this class.

Specified by:
transformInternal in class AbstractContentTransformer2
Parameters:
reader - the source of the content to transform
writer - the target to which to write the transformed content
options - a map of options to use when performing the transformation. The map will never be null.
Throws:
java.lang.Exception - exceptions will be handled by this class - subclasses can throw anything

buildReader

protected java.io.InputStreamReader buildReader(java.io.InputStream is,
                                                java.lang.String encoding,
                                                java.lang.String node)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.