|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.openpcl.pclrenderimage.PclRenderImage
public class PclRenderImage
PclRenderImage may be used with or without the openpcl.jar file. If you imbed the OpenPCLViewer JPanel in your app, then you need the openpcljar file. But if your app has all the UI code you need, and all you want is to pass in PCL bytes to render and put the BufferedImage bitmap on your screen, then you don't need the openpcl.jar file at all. The PclRenderImage class and all its rendering objects parse a byte array of PCL that was passed in through one of the Interface IPclRenderImage methods that start with "renderImage...()", and renders the visual image on a java.awt.image.BufferedImage bitmap that is returned from the renderImage...() call. PclRenderImage internally reuses the same BufferedImage that it blanks out and draws on for each different page shown or zoom change instead of eating up a lot of memory if new BufferdImages were being made only to be JVM garbage collected later at each next page to render or zoom change. Drawing speed is good and no more memory is allocated than for one image. On each of the different renderImage...() calls, if it returns null instead of the rendered page BufferedImage, then call getLastErrorString() that the calling UI code can put on the screen for the user to see the error message. The implemented interface IPclRenderImage are call into methods that can return Object values. The implemented interface PclCommandEvent is in RmsTools. There are no callback methods that the class that instantiated this class must impelement.
Constructor Summary | |
---|---|
PclRenderImage()
Constructor. |
Method Summary | |
---|---|
void |
blankOutBufferedImage()
Blank out the BufferedImage on the screen of the current selected view. |
void |
charFoundEvent(char nextChar,
int pBufferPos)
|
void |
commandFoundEvent(String cmdLeadin,
String cmdValue,
String cmdTerminator,
byte[] cmdData,
int pBufferPos)
|
protected BufferedImage |
createNewBufferedImageToDrawOn()
Create a new BufferredImage all ready to draw on |
void |
freeUpMemory()
When the user closes the view frame of one of the views on the screen, the calling UI code can call this method that frees up memory in PclRenderImage. |
BufferedImage |
getBufferedImageToDrawOn()
Get the BufferedImage to draw on for purposes of an external app can call methods on the BufferedImage object which can change how it looks on the screen. |
byte[] |
getCurrentClickedPagePclBytes()
|
double |
getCurrentZoomFactor()
|
String |
getFileNameNoPath()
|
String |
getFullFilePathAndName()
|
protected Graphics2D |
getGraphicsWithRenderHints(BufferedImage pBufferedImage)
|
BufferedImage |
getImageForPage(int pPageNumber,
byte[] pPrintTimePclBytes,
boolean pIsForPrinting,
String pPaperSize,
double pZoomFactor)
The PCL for the passed in page number will be rendered to a BufferedImage. |
boolean |
getIsDrawingForPrinting()
|
boolean |
getIsSoftFontMode()
|
boolean |
getIsStateBuildingPclPages()
|
String |
getLastRenderErrorString()
Get the last error string. |
int |
getMultipleOpenId()
|
ArrayList<PriPclPage> |
getPagesArrayList()
|
String |
getPaperSizeForPage(int pPageNumber)
Get the Paper Size int that was in the original Pcl bytes for the passed in page. |
boolean |
getParsePclIs1stPass()
|
byte[] |
getPclBytesForPage(int pPageNumber)
Get the Pcl bytes for page N |
int |
getPclPageCount()
Returns the number of separate pages found by parsing the passed in Pcl bytes in splitIntoSeparatePclPages(). |
PriCharWidthTables |
getPriCharWidthTables()
|
PriCursorPos |
getPriCursorPos()
|
PriDrawText |
getPriDrawText()
|
PriFonts |
getPriFonts()
|
PriPageSettings |
getPriPageSettings()
|
PriParseMacroBytes |
getPriParseMacroBytes()
|
PriParseSoftFontBytes |
getPriParseSoftFontBytes()
|
PriPclPage |
getPriPclPage()
|
PriRasterDrawing |
getPriRasterDrawing()
|
PriRectDrawing |
getPriRectDrawing()
|
String |
getShowHideTagBaseString()
|
boolean |
getWantToCenterCharInCharCellBox()
|
protected void |
handleFormFeedFound(int pBufferPos)
|
protected void |
initializeForSplitPages()
Initialize before splitting the Pcl bytes into separate pages. |
String |
loadFromFileSplitIntoSeparatePclPages(String pFullPathAndFilename)
Read the PCL bytes the passed in String full path and filename. |
String |
loadFromUrlSplitIntoSeparatePclPages(String pUrl)
Read the PCL bytes the passed in String URL. |
protected BufferedImage |
parseAndRender(byte[] pPclBytes,
boolean pIsForPrinting,
double pAtZoomFactor)
parseAndRender() is a non public method that the 4 public renderImage...() methods call. |
void |
setCurrentClickedPagePclBytes(byte[] pByteArray)
|
void |
setCurrentZoomFactor(double pCurrentZoomFactor)
|
void |
setIsDrawingForPrinting(boolean pIsDrawingForPrinting)
|
void |
setParsePclIs1stPass(boolean pParsePclIs1stPass)
|
void |
setShowHideTagBaseString(String pShowHideTagBaseString)
|
void |
setWantToCenterCharInCharCellBox(boolean pWantToCenterCharInCharCellBox)
|
String |
splitIntoSeparatePclPages(byte[] pPclBytes)
Split the passed in Pcl bytes into separate pages and internally store each page's Pcl bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PclParser mPclParser
protected BufferedImage mBufferedImageToDrawOn
protected Graphics2D mGraphics2D
protected PriCharWidthTables mPriCharWidthTables
protected PriCursorPos mPriCursorPos
protected PriDrawText mPriDrawText
protected PriFonts mPriFonts
protected PriPageSettings mPriPageSettings
protected PriParseMacroBytes mPriParseMacroBytes
protected PriParseSoftFontBytes mPriParseSoftFontBytes
protected PriRasterDrawing mPriRasterDrawing
protected PriRectDrawing mPriRectDrawing
protected byte[] mCurrentClickedPagePclBytes
protected int mMultipleOpenId
protected int mStartIndexOfPclPage
protected int mNumberOfPagesFound
protected static final double sDefaultZoomFactor
protected double mCurrentZoomFactor
protected PriPclPage mPriPclPage
protected ArrayList<PriPclPage> mPagesArrayList
protected ByteArrayOutputStream mByteArrayOutputStream
protected String mFullFilePathAndName
protected String mFileNameNoPath
protected String mLastRenderErrorString
protected static char scLF
protected static char scFF
protected static char scCR
protected long mThreadIdCounter
protected long mCurrentThreadId
protected boolean mIsSoftFontMode
protected boolean mParsePclIs1stPass
protected boolean mIsRecordingAMacro
protected boolean mIsExecutingAMacro
protected boolean mIsDrawingForPrinting
protected boolean mIsStateBuildingPclPages
protected boolean mWantToCenterCharInCharCellBox
protected String mShowHideTagBaseString
Constructor Detail |
---|
public PclRenderImage()
Method Detail |
---|
public PriCharWidthTables getPriCharWidthTables()
public PriCursorPos getPriCursorPos()
public PriDrawText getPriDrawText()
public PriFonts getPriFonts()
public PriPageSettings getPriPageSettings()
public PriParseMacroBytes getPriParseMacroBytes()
public PriParseSoftFontBytes getPriParseSoftFontBytes()
public PriPclPage getPriPclPage()
public PriRasterDrawing getPriRasterDrawing()
public PriRectDrawing getPriRectDrawing()
public ArrayList<PriPclPage> getPagesArrayList()
public byte[] getCurrentClickedPagePclBytes()
public int getMultipleOpenId()
public double getCurrentZoomFactor()
public boolean getIsSoftFontMode()
public boolean getParsePclIs1stPass()
public boolean getIsDrawingForPrinting()
public boolean getIsStateBuildingPclPages()
public boolean getWantToCenterCharInCharCellBox()
public String getShowHideTagBaseString()
public String getFileNameNoPath()
public String getFullFilePathAndName()
public void setCurrentClickedPagePclBytes(byte[] pByteArray)
public void setParsePclIs1stPass(boolean pParsePclIs1stPass)
public void setIsDrawingForPrinting(boolean pIsDrawingForPrinting)
public void setWantToCenterCharInCharCellBox(boolean pWantToCenterCharInCharCellBox)
public void setShowHideTagBaseString(String pShowHideTagBaseString)
public void setCurrentZoomFactor(double pCurrentZoomFactor)
protected void handleFormFeedFound(int pBufferPos)
public void charFoundEvent(char nextChar, int pBufferPos)
charFoundEvent
in interface PclCommandEvent
public void commandFoundEvent(String cmdLeadin, String cmdValue, String cmdTerminator, byte[] cmdData, int pBufferPos)
commandFoundEvent
in interface PclCommandEvent
protected BufferedImage createNewBufferedImageToDrawOn()
protected Graphics2D getGraphicsWithRenderHints(BufferedImage pBufferedImage)
protected void initializeForSplitPages()
protected BufferedImage parseAndRender(byte[] pPclBytes, boolean pIsForPrinting, double pAtZoomFactor)
pPclBytes
- pAtZoomFactor
-
public void freeUpMemory()
pImageNumber
- public String splitIntoSeparatePclPages(byte[] pPclBytes)
splitIntoSeparatePclPages
in interface IPclRenderImage
pPclBytes
-
public int getPclPageCount()
getPclPageCount
in interface IPclRenderImage
public BufferedImage getImageForPage(int pPageNumber, byte[] pPrintTimePclBytes, boolean pIsForPrinting, String pPaperSize, double pZoomFactor)
getImageForPage
in interface IPclRenderImage
pPageNumber.
- The Pcl page number to render to the image.pPrintTimePclBytes.
- Draw these additional PCL bytes on the print image.pIsForPrinting.
- If true non printing items like signature blocks won't be rendered.pPaperSize.
- If a paper size is not specified in the PCL, this paper size will be used. "LTR" or "LGL".pZoomFactor.
- This is mandatory (see note for why).
public String getLastRenderErrorString()
getLastRenderErrorString
in interface IPclRenderImage
public String loadFromFileSplitIntoSeparatePclPages(String pFullPathAndFilename)
loadFromFileSplitIntoSeparatePclPages
in interface IPclRenderImage
pFullPathAndFilename
-
public String loadFromUrlSplitIntoSeparatePclPages(String pUrl)
loadFromUrlSplitIntoSeparatePclPages
in interface IPclRenderImage
pUrl
-
public BufferedImage getBufferedImageToDrawOn()
getBufferedImageToDrawOn
in interface IPclRenderImage
public void blankOutBufferedImage()
blankOutBufferedImage
in interface IPclRenderImage
public byte[] getPclBytesForPage(int pPageNumber)
getPclBytesForPage
in interface IPclRenderImage
public String getPaperSizeForPage(int pPageNumber)
getPaperSizeForPage
in interface IPclRenderImage
pPageNumber
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |