Package com.logicaldoc.stamp
Class StampManager
- java.lang.Object
- 
- com.logicaldoc.stamp.StampManager
 
- 
 public class StampManager extends Object Manager for stamp images- Since:
- 7.3
- Author:
- Marco Meschieri - LogicalDOC
 
- 
- 
Constructor SummaryConstructors Constructor Description StampManager()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyStamp(long docId, long stampId, com.logicaldoc.core.document.DocumentHistory transaction)voidapplyStamp(long docId, Stamp stamp, com.logicaldoc.core.document.DocumentHistory transaction)voidapplyStampBarcodeToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages)voidapplyStampHTMLToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages)static voidapplyStampImageToPages(long tenantId, File doc, String exprX, String exprY, String exprW, String exprH, int rotation, int opacity, File stamp, Integer[] pages)Draw an image to the specified coordinates onto a single pagestatic voidapplyStampTextToPages(File doc, String exprX, String exprY, String exprW, int rotation, int opacity, String text, String color, int fontSize, String fontPath, com.logicaldoc.core.document.Document document, com.logicaldoc.core.security.User user, Integer[] pages)Draw a text to the specified coordinates onto a single pagevoiddelete(long stampId)Deletes the given stamp and all related resourcescom.logicaldoc.core.conversion.FormatConverterManagergetConverterManager()com.logicaldoc.core.document.dao.DocumentDAOgetDocDao()com.logicaldoc.core.document.DocumentManagergetManager()static Integer[]getPagesFromExpression(String expression)byte[]getStampBytes(long stampId)Retrieves the unencrypted stream of the stamp imageStampDAOgetStampDao()FilegetStampsFolder()com.logicaldoc.core.store.StorergetStorer()static intprocessExpression(String expression, long tenantId, int pageWidth, int pageHeight, int imageWidth, int imageHeight)Processes the expression for X or Y positioning.static StringprocessText(String text, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user)Processes the text to be rendered using the automation.voidsetConfig(com.logicaldoc.util.config.ContextProperties config)voidsetConverterManager(com.logicaldoc.core.conversion.FormatConverterManager converterManager)voidsetDocDao(com.logicaldoc.core.document.dao.DocumentDAO docDao)voidsetManager(com.logicaldoc.core.document.DocumentManager manager)voidsetStampDao(StampDAO stampDao)voidsetStampsFolder(File stampsFolder)voidsetStorer(com.logicaldoc.core.store.Storer storer)
 
- 
- 
- 
Method Detail- 
getStampBytespublic byte[] getStampBytes(long stampId) throws ExceptionRetrieves the unencrypted stream of the stamp image- Parameters:
- stampId- ID of the stamp
- Returns:
- content of the stamp
- Throws:
- Exception- a generic error
 
 - 
deletepublic void delete(long stampId) throws IOExceptionDeletes the given stamp and all related resources- Parameters:
- stampId- identifier of the stamp
- Throws:
- IOException- cannot delete the stamp file
 
 - 
applyStamppublic void applyStamp(long docId, Stamp stamp, com.logicaldoc.core.document.DocumentHistory transaction) throws Exception- Throws:
- Exception
 
 - 
applyStamppublic void applyStamp(long docId, long stampId, com.logicaldoc.core.document.DocumentHistory transaction) throws Exception- Throws:
- Exception
 
 - 
applyStampHTMLToPagespublic void applyStampHTMLToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages) throws IOException - Throws:
- IOException
 
 - 
applyStampBarcodeToPagespublic void applyStampBarcodeToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages) throws IOException - Throws:
- IOException
 
 - 
applyStampTextToPagespublic static void applyStampTextToPages(File doc, String exprX, String exprY, String exprW, int rotation, int opacity, String text, String color, int fontSize, String fontPath, com.logicaldoc.core.document.Document document, com.logicaldoc.core.security.User user, Integer[] pages) throws IOException Draw a text to the specified coordinates onto a single page- Parameters:
- doc- file of the document
- exprX- X coordinate on the page where the left bottom corner of the text should be located. Regard that 0 is the left bottom of the pdf page
- exprY- Y coordinate on the page where the left bottom corner of the text should be located
- exprW- Width of the text
- rotation- Rotation expressed in degrees
- opacity- Opacity (0=transparent 1=opaque)
- text- Text that is written to the PDF
- color- HTML color for the text
- fontSize- The font size
- fontPath- the path of the font's file(leave empty to use the system helvetica font)
- document- The pdf document representation
- pages- Array of pages numbers to process
- user- The current user
- Throws:
- IOException- error printing the stamp inside the file
 
 - 
processTextpublic static String processText(String text, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user) Processes the text to be rendered using the automation. Available variables are:- DATE
- TIMESTAMP
- CURRENT_DATE
- document
- extended attributes
- user
 - Parameters:
- text- The expression to process(you can use the macros)
- doc- The document to process
- user- The current user
- Returns:
- The processed text
 
 - 
processExpressionpublic static int processExpression(String expression, long tenantId, int pageWidth, int pageHeight, int imageWidth, int imageHeight) Processes the expression for X or Y positioning. Available variables are:- PAGE_WIDTH
- PAGE_HEIGHT
- PAGE_CENTER
- PAGE_MIDDLE
- IMAGE_WIDTH
- IMAGE_HEIGHT
 - Parameters:
- expression- The expression to process(you can use the macros)
- tenantId- identifier of the tenant
- pageWidth- width of the page
- pageHeight- height of the page
- imageWidth- width of the image
- imageHeight- height of the image
- Returns:
- The coordinate
 
 - 
applyStampImageToPagespublic static void applyStampImageToPages(long tenantId, File doc, String exprX, String exprY, String exprW, String exprH, int rotation, int opacity, File stamp, Integer[] pages) throws IOExceptionDraw an image to the specified coordinates onto a single page- Parameters:
- tenantId- Identifier of the tenant
- doc- PDF file the image should be written to
- exprX- X coordinate on the page where the left bottom corner of the image should be located. Regard that 0 is the left bottom of the pdf page
- exprY- Y coordinate on the page where the left bottom corner of the image should be located.
- exprW- Optional width of the stamp
- exprH- Optional height of the stamp
- rotation- Rotation expressed in degrees
- opacity- Opacity (0=transparent 1=opaque)
- stamp- File path of the image that is written to the PDF
- pages- Array of pages numbers to process
- Throws:
- IOException- cannot apply the stamp inside the file
 
 - 
getStampsFolderpublic File getStampsFolder() 
 - 
setStampsFolderpublic void setStampsFolder(File stampsFolder) 
 - 
getDocDaopublic com.logicaldoc.core.document.dao.DocumentDAO getDocDao() 
 - 
setDocDaopublic void setDocDao(com.logicaldoc.core.document.dao.DocumentDAO docDao) 
 - 
getStampDaopublic StampDAO getStampDao() 
 - 
setStampDaopublic void setStampDao(StampDAO stampDao) 
 - 
getStorerpublic com.logicaldoc.core.store.Storer getStorer() 
 - 
setStorerpublic void setStorer(com.logicaldoc.core.store.Storer storer) 
 - 
getManagerpublic com.logicaldoc.core.document.DocumentManager getManager() 
 - 
setManagerpublic void setManager(com.logicaldoc.core.document.DocumentManager manager) 
 - 
getConverterManagerpublic com.logicaldoc.core.conversion.FormatConverterManager getConverterManager() 
 - 
setConverterManagerpublic void setConverterManager(com.logicaldoc.core.conversion.FormatConverterManager converterManager) 
 - 
setConfigpublic void setConfig(com.logicaldoc.util.config.ContextProperties config) 
 
- 
 
-