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 Summary
Constructors Constructor Description StampManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyStamp(long docId, long stampId, com.logicaldoc.core.document.DocumentHistory transaction)
void
applyStamp(long docId, Stamp stamp, com.logicaldoc.core.document.DocumentHistory transaction)
void
applyStampBarcodeToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages)
void
applyStampHTMLToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages)
static void
applyStampImageToPages(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 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)
Draw a text to the specified coordinates onto a single pagevoid
delete(long stampId)
Deletes the given stamp and all related resourcescom.logicaldoc.core.conversion.FormatConverterManager
getConverterManager()
com.logicaldoc.core.document.dao.DocumentDAO
getDocDao()
com.logicaldoc.core.document.DocumentManager
getManager()
static Integer[]
getPagesFromExpression(String expression)
byte[]
getStampBytes(long stampId)
Retrieves the unencrypted stream of the stamp imageStampDAO
getStampDao()
File
getStampsFolder()
com.logicaldoc.core.store.Storer
getStorer()
static int
processExpression(String expression, long tenantId, int pageWidth, int pageHeight, int imageWidth, int imageHeight)
Processes the expression for X or Y positioning.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.void
setConfig(com.logicaldoc.util.config.ContextProperties config)
void
setConverterManager(com.logicaldoc.core.conversion.FormatConverterManager converterManager)
void
setDocDao(com.logicaldoc.core.document.dao.DocumentDAO docDao)
void
setManager(com.logicaldoc.core.document.DocumentManager manager)
void
setStampDao(StampDAO stampDao)
void
setStampsFolder(File stampsFolder)
void
setStorer(com.logicaldoc.core.store.Storer storer)
-
-
-
Method Detail
-
getStampBytes
public byte[] getStampBytes(long stampId) throws Exception
Retrieves the unencrypted stream of the stamp image- Parameters:
stampId
- ID of the stamp- Returns:
- content of the stamp
- Throws:
Exception
-
delete
public void delete(long stampId) throws IOException
Deletes the given stamp and all related resources- Parameters:
stampId
- identifier of the stamp- Throws:
IOException
- cannot delete the stamp file
-
applyStamp
public void applyStamp(long docId, Stamp stamp, com.logicaldoc.core.document.DocumentHistory transaction) throws Exception
- Throws:
Exception
-
applyStamp
public void applyStamp(long docId, long stampId, com.logicaldoc.core.document.DocumentHistory transaction) throws Exception
- Throws:
Exception
-
applyStampHTMLToPages
public void applyStampHTMLToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages) throws IOException
- Throws:
IOException
-
applyStampBarcodeToPages
public void applyStampBarcodeToPages(File stampedDocFile, Stamp stamp, com.logicaldoc.core.document.Document doc, com.logicaldoc.core.security.User user, Integer[] pages) throws IOException
- Throws:
IOException
-
applyStampTextToPages
public 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 documentexprX
- 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 pageexprY
- Y coordinate on the page where the left bottom corner of the text should be locatedexprW
- Width of the textrotation
- Rotation expressed in degreesopacity
- Opacity (0=transparent 1=opaque)text
- Text that is written to the PDFcolor
- HTML color for the textfontSize
- The font sizefontPath
- the path of the font's file(leave empty to use the system helvetica font)document
- The pdf document representationpages
- Array of pages numbers to processuser
- The current user- Throws:
IOException
- error printing the stamp inside the file
-
processText
public 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 processuser
- The current user- Returns:
- The processed text
-
processExpression
public 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 tenantpageWidth
- width of the pagepageHeight
- height of the pageimageWidth
- width of the imageimageHeight
- height of the image- Returns:
- The coordinate
-
applyStampImageToPages
public static void applyStampImageToPages(long tenantId, File doc, String exprX, String exprY, String exprW, String exprH, int rotation, int opacity, File stamp, Integer[] pages) throws IOException
Draw an image to the specified coordinates onto a single page- Parameters:
tenantId
- Identifier of the tenantdoc
- PDF file the image should be written toexprX
- 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 pageexprY
- Y coordinate on the page where the left bottom corner of the image should be located.exprW
- Optional width of the stampexprH
- Optional height of the stamprotation
- Rotation expressed in degreesopacity
- Opacity (0=transparent 1=opaque)stamp
- File path of the image that is written to the PDFpages
- Array of pages numbers to process- Throws:
IOException
- cannot apply the stamp inside the file
-
getStampsFolder
public File getStampsFolder()
-
setStampsFolder
public void setStampsFolder(File stampsFolder)
-
getDocDao
public com.logicaldoc.core.document.dao.DocumentDAO getDocDao()
-
setDocDao
public void setDocDao(com.logicaldoc.core.document.dao.DocumentDAO docDao)
-
getStampDao
public StampDAO getStampDao()
-
setStampDao
public void setStampDao(StampDAO stampDao)
-
getStorer
public com.logicaldoc.core.store.Storer getStorer()
-
setStorer
public void setStorer(com.logicaldoc.core.store.Storer storer)
-
getManager
public com.logicaldoc.core.document.DocumentManager getManager()
-
setManager
public void setManager(com.logicaldoc.core.document.DocumentManager manager)
-
getConverterManager
public com.logicaldoc.core.conversion.FormatConverterManager getConverterManager()
-
setConverterManager
public void setConverterManager(com.logicaldoc.core.conversion.FormatConverterManager converterManager)
-
setConfig
public void setConfig(com.logicaldoc.util.config.ContextProperties config)
-
-