com.openpcl.pclrenderimage.api
Interface IPclRenderImage

All Known Implementing Classes:
PclRenderImage

public interface IPclRenderImage

Methods in the PclRenderImage class in the pclrnderimage.jar that the calling app UI code can call. This calling app can be either the OpenPCLViewer JPanel in openpcl.jar or other other external app(s) you write.

Author:
howard 9/27/06

Method Summary
 void blankOutBufferedImage()
          Blank out the BufferedImage on the screen.
 BufferedImage getBufferedImageToDrawOn()
          Get the BufferedImage to draw on for purposes of an external app can call methods on the BufferedImage object so the external app can directly draw on the image if wanted.
 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.
 String getLastRenderErrorString()
          Get the last error string.
 String getPaperSizeForPage(int pPageNumber)
          Get the Paper Size int that was in the original Pcl bytes for the passed in page.
 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().
 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.
 String splitIntoSeparatePclPages(byte[] pPclBytes)
          Split the passed in Pcl bytes into separate pages and internally store each page's Pcl bytes.
 

Method Detail

splitIntoSeparatePclPages

String splitIntoSeparatePclPages(byte[] pPclBytes)
Split the passed in Pcl bytes into separate pages and internally store each page's Pcl bytes. In DocMaster, this is "ParseEntirePCL".

Parameters:
pPclBytes -
Returns:
If error returns error String. If no error then returns null

getPclPageCount

int getPclPageCount()
Returns the number of separate pages found by parsing the passed in Pcl bytes in splitIntoSeparatePclPages().

Returns:
int

getImageForPage

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. Passing in the zoom factor is mandatory because the rendering code draws everything (text, rectanges, raster dot areas, etc) pre-scaled to exactly how small or big is needed and clips the overall image width and height to make the whole image look zoomed smaller or bigger. The UI code can then put this image on the screen without scaling the image on the UI side. Doing it this way is needed so the image looks sharp because scaling using the AffineTransform scale leaves the image too blurry for both zoom in or out. In DocMaster, this is getImage().

Parameters:
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).
Returns:
BufferedImage. If null is returned, then call getLastErrorString()

getLastRenderErrorString

String getLastRenderErrorString()
Get the last error string. Call this if getImageForPage() returned null instead of returning the BufferedImage.

Returns:
String of the last error

loadFromFileSplitIntoSeparatePclPages

String loadFromFileSplitIntoSeparatePclPages(String pFullPathAndFilename)
Read the PCL bytes the passed in String full path and filename. Then this calls splitIntoSeparatePclPages to split the Pcl into its separate pages. No image is rendered yet. To get the image for a page number, call getImageForPage().

Parameters:
pFullPathAndFilename -
Returns:
If error returns error String. If no error then returns null

loadFromUrlSplitIntoSeparatePclPages

String loadFromUrlSplitIntoSeparatePclPages(String pUrl)
Read the PCL bytes the passed in String URL. Then this calls splitIntoSeparatePclPages to split the Pcl into its separate pages. No image is rendered yet. To get the image for a page number, call getImageForPage().

Parameters:
pUrl -
Returns:
If error returns error String. If no error then returns null

getBufferedImageToDrawOn

BufferedImage getBufferedImageToDrawOn()
Get the BufferedImage to draw on for purposes of an external app can call methods on the BufferedImage object so the external app can directly draw on the image if wanted.

Returns:
BufferedImage or if error returns null in which case call getLastErrorString()

blankOutBufferedImage

void blankOutBufferedImage()
Blank out the BufferedImage on the screen.


getPclBytesForPage

byte[] getPclBytesForPage(int pPageNumber)
Get the Pcl bytes for page N


getPaperSizeForPage

String getPaperSizeForPage(int pPageNumber)
Get the Paper Size int that was in the original Pcl bytes for the passed in page. Each page has its own paper size setting, which was set in the PclRenderImage.commandFoundEvent() for the Pcl command "ESC & L # A". When a Paper Size Pcl command is found, it is set on the current page and also on the following pages until another Paper Size command is found. For those Pcl files that have been dieted/scrubbed, and the Paper Size is not there, then the default Paper Size is used from PriPageSettings.sDefaultPaperSize.

Parameters:
pPageNumber -
Returns:
String


OpenPCL http://www.openpcl.com