sferyx.administration.pdfgenerator
Class PDFGeneratorOracleBean

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by sferyx.administration.pdfgenerator.PDFGeneratorOracleBean
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class PDFGeneratorOracleBean
extends java.awt.Container

This class has been optimized to deliver correct generation of Rich Text content for Oracle Reports and provide general PDF generation capabilities for OracleForms. Oracle Forms Extended support wrapper - this class is intended for integration with Oracle Forms/ Oracle Forms Builder and provides better compatibility with the Oracle Runtime System.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static boolean isOracleBean
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PDFGeneratorOracleBean()
          Creates a new instance of PDFGeneratorOracleBean
 
Method Summary
 void addReportParameter(java.lang.String name, java.lang.String value)
          Adds parameters to be used for generation of the report - this method can be used multiple times to add multiple parameters.
 void appendContentToContentBuffer(java.lang.String content)
          Appends new string to existing content buffer.
 void clearReportParameters()
          Clears all the report parameters set previously using addReportParameter .
 void closeBufferAndGeneratePDF(java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation)
          Closes the existing content buffer and inserts its content inside the PDF Generator.
 java.lang.String closeBufferAndGeneratePDFSynchronously(java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation)
          Closes the existing content buffer and inserts its content inside the PDF Generator.
 java.lang.String closeBufferAndGenerateTempPDFFile(java.lang.String standardPageFormat, java.lang.String orinetation)
          Closes the existing content buffer and inserts its content inside the PDF Generator and generates a temporary file where the PDF file is saved - the name of the temp file is returned as a result from the method.
 void generatePDF(java.lang.String sourceURL, java.lang.String destinationFile)
          Generates a pdf file from given URL and saves it to a given filename using default paper size and orientation
 void generatePDFFromContent(java.lang.String content, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation)
          Generates a pdf file from given html/text content and saves it to a given filename, using paper size and paper orientation such as LANDSCAPE or PORTRAIT
 void generatePDFFromDocxURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
          Generates pdf automatically for given URL source containing a MS Word Docx file.
 void generatePDFFromReport(java.lang.String sourceURL, java.lang.String standardPageFormat, java.lang.String orinetation)
          Generates a pdf file from given URL and saves it to temporary file showing the ready PDF document into the available PDF viewer
 void generatePDFFromRTFURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orientation)
          Generates pdf automatically for given URL source containing Rich Text Format RTF file.
 void generatePDFFromURL(java.lang.String sourceURL, java.lang.String destinationFile, java.lang.String standardPageFormat, java.lang.String orinetation)
          Generates a pdf file from given URL and saves it to a given filename using paper size and orientation
 java.lang.String getTTFFontFolderName()
           
 boolean isDoNotBreakListsAcrossPages()
           
 boolean isDoNotBreakTablesAcrossPages()
           
 void openContentBuffer()
          Opens the new content buffer for inserting content inside the PDF Generator.
 void setCharset(java.lang.String charcterSet)
          Sets the character set to be used - currently directly supported is utf-8 - it can be used for virtually any language and all TTF files will be automatically embedded into the PDF file
 void setDiscardEmptyPages(boolean discard)
          Specifies to automatically discard all pages that do not contain text and are practically a blank pages.
 void setDoNotBreakListsAcrossPages(boolean disablebreak)
          If set to true, the PDFGenerator will try to not break list elements when page break is encountered if the list is not longer than the page height.
 void setDoNotBreakTablesAcrossPages(boolean disablebreak)
          If set to true, the PDFGenerator will try to not break tables when page break is encountered if the table is not longer than the page height.
 void setFooter(java.lang.String content)
          Generates the footer for each page in the document.
 void setGeneratePageNumbers(boolean generate, java.lang.String text)
          Generates page numbers for each page in the document.
 void setHeader(java.lang.String content)
          Generates the header for each page in the document.
 void setMarginsForStandardPageFormat(int top, int bottom, int left, int right)
          Sets the margins to be used when the page format is set using the standard string like "A4" or "Letter" - this values will not be considered it PageFormat object is used to set the page format
 void setOpenGeneratedFileInPDFViewer(boolean show)
          Indicates whether to automatically open the default PDF Viewer and show the generated file or not.
 void setScaleToFitWidth(boolean scale)
          Indicates whether to rescale the page in order to fit the give PageFormat - the default is true
 void setTTFFontFolderName(java.lang.String folderName)
          Set the absolute path to the folder which contains the TrueType fonts to be used when generatiing the PDF documents.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isOracleBean

public static boolean isOracleBean
Constructor Detail

PDFGeneratorOracleBean

public PDFGeneratorOracleBean()
Creates a new instance of PDFGeneratorOracleBean

Method Detail

setDiscardEmptyPages

public void setDiscardEmptyPages(boolean discard)
Specifies to automatically discard all pages that do not contain text and are practically a blank pages.


setHeader

public void setHeader(java.lang.String content)
Generates the header for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered as a header on the pages. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the top margin in order to make enough room for the header if necessary.


setDoNotBreakTablesAcrossPages

public void setDoNotBreakTablesAcrossPages(boolean disablebreak)
If set to true, the PDFGenerator will try to not break tables when page break is encountered if the table is not longer than the page height. The default value is false


isDoNotBreakTablesAcrossPages

public boolean isDoNotBreakTablesAcrossPages()

setDoNotBreakListsAcrossPages

public void setDoNotBreakListsAcrossPages(boolean disablebreak)
If set to true, the PDFGenerator will try to not break list elements when page break is encountered if the list is not longer than the page height. The default value is false


isDoNotBreakListsAcrossPages

public boolean isDoNotBreakListsAcrossPages()

setGeneratePageNumbers

public void setGeneratePageNumbers(boolean generate,
                                   java.lang.String text)
Generates page numbers for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered practically as footer in the pages and will parse the special directive "@#SferyxPDFGenerator-PageNumber#@" in order to place the page number inside the custom formatting. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the top margin in order to make enough room for the page numbering if necessary. Example: <p align=center style="padding-top:30px;border-top:1px solid #0000FF;"><font face="arial" color="blue">Page: @#SferyxPDFGenerator-PageNumber#@</font></p>


setFooter

public void setFooter(java.lang.String content)
Generates the footer for each page in the document. The parameter content can be any plain text or HTML string - it will be parsed and rendered as a footer on the pages. You can includes any HTML element such as images, tables, colors etc. Keep in mind to adjust the bottom margin in order to make enough room for the footer if necessary.


addReportParameter

public void addReportParameter(java.lang.String name,
                               java.lang.String value)
Adds parameters to be used for generation of the report - this method can be used multiple times to add multiple parameters. Please note that this is persistent and once added the parameters will be used until cleared. See clearReportParameters method.


clearReportParameters

public void clearReportParameters()
Clears all the report parameters set previously using addReportParameter .


generatePDFFromReport

public void generatePDFFromReport(java.lang.String sourceURL,
                                  java.lang.String standardPageFormat,
                                  java.lang.String orinetation)
Generates a pdf file from given URL and saves it to temporary file showing the ready PDF document into the available PDF viewer


generatePDFFromURL

public void generatePDFFromURL(java.lang.String sourceURL,
                               java.lang.String destinationFile,
                               java.lang.String standardPageFormat,
                               java.lang.String orinetation)
Generates a pdf file from given URL and saves it to a given filename using paper size and orientation


generatePDFFromRTFURL

public void generatePDFFromRTFURL(java.lang.String sourceURL,
                                  java.lang.String destinationFile,
                                  java.lang.String standardPageFormat,
                                  java.lang.String orientation)
Generates pdf automatically for given URL source containing Rich Text Format RTF file. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromDocxURL

public void generatePDFFromDocxURL(java.lang.String sourceURL,
                                   java.lang.String destinationFile,
                                   java.lang.String standardPageFormat,
                                   java.lang.String orientation)
Generates pdf automatically for given URL source containing a MS Word Docx file. It will generate the file using the given standard page format string such as "A4", "Letter" etc. and and save the file to the given File and page oriantation such as "Portrait" or "Landscape". You can also set the page margins using the method setMarginsForStandardPageFormat


generatePDFFromContent

public void generatePDFFromContent(java.lang.String content,
                                   java.lang.String destinationFile,
                                   java.lang.String standardPageFormat,
                                   java.lang.String orinetation)
Generates a pdf file from given html/text content and saves it to a given filename, using paper size and paper orientation such as LANDSCAPE or PORTRAIT


openContentBuffer

public void openContentBuffer()
Opens the new content buffer for inserting content inside the PDF Generator. This should be used in conjunction with closeBufferAndGeneratePDF() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


appendContentToContentBuffer

public void appendContentToContentBuffer(java.lang.String content)
Appends new string to existing content buffer. This should be used in conjunction with openContentBuffer() and closeBufferAndGeneratePDF(). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


closeBufferAndGeneratePDFSynchronously

public java.lang.String closeBufferAndGeneratePDFSynchronously(java.lang.String destinationFile,
                                                               java.lang.String standardPageFormat,
                                                               java.lang.String orinetation)
Closes the existing content buffer and inserts its content inside the PDF Generator. This should be used in conjunction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


closeBufferAndGeneratePDF

public void closeBufferAndGeneratePDF(java.lang.String destinationFile,
                                      java.lang.String standardPageFormat,
                                      java.lang.String orinetation)
Closes the existing content buffer and inserts its content inside the PDF Generator. This should be used in conjunction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


closeBufferAndGenerateTempPDFFile

public java.lang.String closeBufferAndGenerateTempPDFFile(java.lang.String standardPageFormat,
                                                          java.lang.String orinetation)
Closes the existing content buffer and inserts its content inside the PDF Generator and generates a temporary file where the PDF file is saved - the name of the temp file is returned as a result from the method. This should be used in conjunction with openContentBuffer() and appendContentToContentBuffer(String content). This methods are very useful in environments where long content strings cannot be inserted at once due to some limitations as happens for example in Oracle Forms. See supplied examples in the users manual.


generatePDF

public void generatePDF(java.lang.String sourceURL,
                        java.lang.String destinationFile)
Generates a pdf file from given URL and saves it to a given filename using default paper size and orientation


setOpenGeneratedFileInPDFViewer

public void setOpenGeneratedFileInPDFViewer(boolean show)
Indicates whether to automatically open the default PDF Viewer and show the generated file or not. The default is true


setCharset

public void setCharset(java.lang.String charcterSet)
Sets the character set to be used - currently directly supported is utf-8 - it can be used for virtually any language and all TTF files will be automatically embedded into the PDF file


setScaleToFitWidth

public void setScaleToFitWidth(boolean scale)
Indicates whether to rescale the page in order to fit the give PageFormat - the default is true


setTTFFontFolderName

public void setTTFFontFolderName(java.lang.String folderName)
Set the absolute path to the folder which contains the TrueType fonts to be used when generatiing the PDF documents. Please make sure that this feature is enabled by setting the character set to UTF-8


getTTFFontFolderName

public java.lang.String getTTFFontFolderName()

setMarginsForStandardPageFormat

public void setMarginsForStandardPageFormat(int top,
                                            int bottom,
                                            int left,
                                            int right)
Sets the margins to be used when the page format is set using the standard string like "A4" or "Letter" - this values will not be considered it PageFormat object is used to set the page format