JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

org.jpedal
Class PdfDecoder

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.jpedal.PdfDecoder
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Pageable, java.awt.print.Printable, java.io.Serializable, javax.accessibility.Accessible

public class PdfDecoder
extends javax.swing.JPanel
implements java.awt.print.Printable, java.awt.print.Pageable

Provides an object to decode pdf files and provide a rasterizer if required - Normal usage is to create instance of PdfDecoder and access via public methods. Examples showing usage in org.jpedal.examples - Inherits indirectly from JPanel so can be used as a standard Swing component -

Extends other classes to separate out GUI and business logic but should be regarded as ONE object and PdfPanel should not be instanced - We recommend you access JPedal using only public methods listed in API

See Also:
Serialized Form

Nested Class Summary
 class PdfDecoder.LinearThread
          handles download of rest of file in Linearized mode
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static boolean allowChangeCursor
          Flag if we should allow cursor to change
static java.awt.Color backgroundColor
          The colour of the text once highlighted
static int CLIPPEDIMAGES
          flag to show extraction of clipped images at highest res
static int CMYKIMAGES
          flag to show extraction of raw cmyk images
static int COLOR
          flag to show extraction of color required (used in Storypad grouping)
 int displayRotation
          used by setPageParameters to draw rotated pages
static int dpi
          dpi for final images
static boolean embedWidthData
          flag to tell software to embed x point after each character so we can merge any overlapping text together
static int FINALIMAGES
          flag to show extraction mode includes final scaled/clipped
static JPedalHelper Helper
           
static java.awt.Color highlightColor
          The colour of the highlighting box around the text
static float highlightComposite
          The transparency of the highlighting box around the text stored as a float
static boolean inDemo
          id demo flag disables output in demo
static boolean isDraft
           
static boolean isRunningOnAIX
           
static boolean isRunningOnLinux
           
static boolean isRunningOnMac
          flag to show if on mac so we can code around certain bugs
static boolean isRunningOnWindows
           
static float javaVersion
          version number
 boolean legacyPrintMode
           
 java.awt.Color nonDrawnPageColor
           
static int NOTEXTPRINT
          printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS) - this is the default off setting
 ObjectStore objectStoreRef
          the ObjectStore for this file
static int OCR_PDF
          flag to show text highlights need to be done last
 java.awt.Color pageColor
          page colour for PDF background
 int pageNumber
          current page
static int RAWCOMMANDS
          flag to show extraction mode includes final scaled/clipped
static int RAWIMAGES
          flag to show extraction mode includes original images
static int REMOVE_RENDERSHAPES
          flag to show render mode includes any images
static int RENDERIMAGES
          flag to show render mode includes any images
static int RENDERTEXT
          flag to show render mode includes any text
static boolean showErrorMessages
          flag to enable popup of error messages in JPedal
static boolean showMouseBox
           
static int STANDARDTEXTSTRINGPRINT
          printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS) - overrides embedded fonts for standard fonts (ie Arial)
static int SUBSTITUTE_FONT_USING_FAMILY_NAME
           
static int SUBSTITUTE_FONT_USING_FILE_NAME
           
static int SUBSTITUTE_FONT_USING_FULL_FONT_NAME
           
static int SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME
           
static int SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME_USE_FAMILY_NAME_IF_DUPLICATES
           
static int TEXT
          flag to show extraction mode includes any text
static int TEXTCOLOR
          flag to show extraction of clipped images at highest res
static int TEXTGLYPHPRINT
          printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS)
static int TEXTSTRINGPRINT
          printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS)
 boolean useNewGraphicsMode
           
static java.lang.String version
          // public static final String version = "4.70b22-OS"; /
static int XFORMMETADATA
          flag to show extraction of xforms metadata
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PdfDecoder()
          Recommend way to create a PdfDecoder for renderer only viewer (not recommended for server extraction only processes)
PdfDecoder(boolean newRender)
          Recommend way to create a PdfDecoder if no rendering of page may be required
Otherwise use PdfDecoder()
 
Method Summary
 void addExternalHandler(java.lang.Object newHandler, int type)
          allows external helper classes to be added to JPedal to alter default functionality - not part of the API and should be used in conjunction with IDRsolutions only
if Options.FormsActionHandler is the type then the newHandler should be of the form org.jpedal.objects.acroforms.ActionHandler
 void clearScreen()
          remove all displayed objects for JPanel display (wipes current page)
 void closePdfFile()
          convenience method to close the current PDF file
 void decodePage(int rawPage)
          decode a page, - page must be between 1 and PdfDecoder.getPageCount() - Will kill off if already running returns minus page if trying to open linearized page not yet available
 void decodePageForMarkedContent(int pageNumber, org.jpedal.objects.raw.PdfObject pdfObject, java.lang.Object pageStream)
          extract marked content - not yet live
 void decodePageInBackground(int i)
          decode a page as a background thread (use other background methods to access data) we now recommend you use decodePage as this has been heavily optimised for speed
 void dispose()
          convenience method to remove all items from memory If you wish to clear all static objects as well, you will also need to call disposeAllStatic()
static void disposeAllStatic()
          remove all static elements - only do once completely finished with JPedal as will not be reinitialised
 void drawAdditionalObjectsOverPage(int page, int[] type, java.awt.Color[] colors, java.lang.Object[] obj)
          allow user to add grapical content on top of page - for display ONLY Additional calls will overwrite current settings on page ONLY works in SINGLE VIEW displaymode
 void ensurePointIsVisible(java.awt.Point p)
          make screen scroll to ensure point is visible
 void flushAdditionalObjectsOnPage(int page)
          allow user to remove all additional grapical content from the page (only for display) ONLY works in SINGLE VIEW displaymode
 void flushObjectValues(boolean reinit)
          provide method for outside class to clear store of objects once written out to reclaim memory
 PdfGroupingAlgorithms getBackgroundGroupingObject()
          returns object containing grouped text from background grouping - Please see org.jpedal.examples.text for example code
 int getCurrentPrintPage()
          return page currently being printed or -1 if finished
 java.awt.Rectangle getCursorBoxOnScreen()
           
 int getDisplayView()
          returns view mode used - ie SINGLE_PAGE,CONTINUOUS,FACING,CONTINUOUS_FACING (no effect in OS versions)
 DPIFactory getDPIFactory()
          return handle on PDFFactory which adjusts display size so matches size in Acrobat
 org.jpedal.render.DynamicVectorRenderer getDynamicRenderer()
          gets DynamicVector Object
 org.jpedal.render.DynamicVectorRenderer getDynamicRenderer(boolean reset)
          gets DynamicVector Object - NOT PART OF API and subject to change (DO NOT USE)
 java.lang.Object getExternalHandler(int type)
          allows external helper classes to be accessed if needed - also allows user to access SwingGUI if running full Viewer package - not all Options available to get - please contact IDRsolutions if you are looking to use
 PdfFileInformation getFileInformationData()
          method to return null or object giving access info fields and metadata.
 java.lang.String getFileName()
           
 java.lang.Object[] getFormDataForField(java.lang.String formName)
          return PDF data object or Objects for field containing values from PDF file This will take either the Name or the PDFref (ie Box or 12 0 R) This can return an object[] if Box is a radio button with multiple vales so you need to check instanceof Object[] on data In the case of a PDF with radio buttons Box (12 0 R), Box (13 0 R), Box (14 0 R) getFormDataAsObject(Box) would return an Object which is actually Object[3] getFormDataAsObject(12 0 R) would return an Object which is a single value
 org.jpedal.objects.acroforms.rendering.AcroRenderer getFormRenderer()
          Allow user to access Forms renderer - returns null not available (should not generally be needed)
 PdfGroupingAlgorithms getGroupingObject()
          returns object containing grouped text of last decoded page - if no page decoded, a Runtime exception is thrown to warn user Please see org.jpedal.examples.text for example code.
 float getHiResUpscaleFactor()
          return scaleup factor applied to last Hires image of page generated negative values mean no upscaling applied and should be ignored
 java.lang.String getInfo(int type)
          Returns list of the fonts used on the current page decoded or null type can be PdfDictionary.Font or PdfDictionary.Image
 int getInsetH()
           
 int getInsetW()
           
 org.jpedal.io.PdfObjectReader getIO()
           
 java.lang.Object getJPedalObject(int id)
          will return some dictionary values - if not a set value, will return null
 int getlastPageDecoded()
          return page number for last page decoded (only use in SingleDisplay mode)
 org.w3c.dom.Document getMarkedContent()
          return markedContent object as XML Document
 java.awt.Dimension getMaximumSize()
          get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set (ie a PDF size 800 * 600 with a scaling factor of 2 will return 1600 *1200)
 java.awt.Dimension getMinimumSize()
          get width
 java.util.Set getNamesForAllFields()
          return full list of Fields for Annots and Forms
 int getNumberOfPages()
          part of pageable interface - used only in printing Use getPageCount() for number of pages
 ObjectStore getObjectStore()
          return object which provides access to file images and name
 org.w3c.dom.Document getOutlineAsXML()
          return a DOM document containing the PDF Outline object as a DOM Document - may return null
 org.jpedal.objects.outlines.OutlineData getOutlineData()
          provide direct access to outlineData object
 int getPageAlignment()
          // // /** return type of alignment for pages if smaller than panel - see options in Display class.
 java.awt.image.BufferedImage getPageAsHiRes(int pageIndex)
           
 java.awt.image.BufferedImage getPageAsHiRes(int pageIndex, boolean isTransparent)
           
 java.awt.image.BufferedImage getPageAsHiRes(int pageIndex, java.util.Map params)
           
 java.awt.image.BufferedImage getPageAsHiRes(int pageIndex, java.util.Map params, boolean isTransparent)
           
 java.awt.image.BufferedImage getPageAsImage(int pageIndex)
          generate BufferedImage of a page in current file Page size is defined by CropBox
 java.awt.image.BufferedImage getPageAsTransparentImage(int pageIndex)
          generate BufferedImage of a page in current file
 int getPageCount()
          get page count of current PDF file
 java.lang.String getPageDecodeReport()
          return any errors or other messages while calling decodePage() - zero length is no problems
 boolean getPageDecodeStatus(int status)
           
 java.lang.String getPageDecodeStatusReport(int status)
          get page statuses
 java.lang.String getPageFailureMessage()
          Return String with all error messages from last printed (useful for debugging)
 java.awt.print.PageFormat getPageFormat(int p)
          part of pageable interface
 int getPageFromObjectRef(java.lang.String ref)
          given a ref, what is the page
 java.util.Iterator getPageInfo(int type)
          return details on page for type (defined in org.jpedal.constants.PageInfo) or null if no values Unrecognised key will throw a RunTime exception null returned if JPedal not clear on result
 org.jpedal.render.DynamicVectorRenderer getPageView(java.lang.String currentPageOffset, int pageNumber)
           
 org.jpedal.objects.PdfData getPdfBackgroundData()
          Access should not generally be required to this class.
 PdfImageData getPdfBackgroundImageData()
          provide method for outside class to get data object containing images.
 org.jpedal.objects.PdfData getPdfData()
          Access should not generally be required to this class.
 int getPDFHeight()
          get sizes of panel - This is the PDF pagesize
 PdfImageData getPdfImageData()
          provide method for outside class to get data object containing images
 PdfPageData getPdfPageData()
          Provides method for outside class to get data object containing information on the page for calculating grouping
Please note: Structure of PdfPageData is not guaranteed to remain constant.
 java.lang.String getPDFVersion()
          get PDF version in file
 int getPDFWidth()
          get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set
 java.awt.Dimension getPreferredSize()
          get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set (ie a PDF size 800 * 600 with a scaling factor of 2 will return 1600 *1200)
 java.awt.print.Printable getPrintable(int page)
          part of pageable interface
 java.lang.String getReferenceforPage(int page)
          reference for Page object
 float getScaling()
           
 int getScrollInterval()
          return amount to scroll window by when scrolling (default is 10)
 java.awt.image.BufferedImage getSelectedRectangleOnscreen(float t_x1, float t_y1, float t_x2, float t_y2, float scaling)
          If running in GUI mode, will extract a section of rendered page as BufferedImage -coordinates are PDF co-ordinates.
 org.jpedal.text.TextLines getTextLines()
          access textlines object
 java.awt.Point getUserOffsets(int mode)
           
 boolean hasAllImages()
          flag to show if we suspect problem with some images
 boolean hasEmbeddedFonts()
          shows if embedded fonts present on page just decoded
 boolean hasJavascript()
          show if page is an XFA form
 boolean hasOutline()
          flag to show if PDF document contains an outline
static void init(boolean newEmbedWidthData)
          This will be needed for text extraction as it paramter makes sure widths included in text stream
 boolean isEncrypted()
          return true if the current pdf file is encrypted
check isFileViewable(),

if file is encrypted and not viewable - a user specified password is needed.
 boolean isExtractionAllowed()
          show if content can be extracted
 boolean isFileViewable()
          show if encrypted file can be viewed,
if false a password needs entering
 boolean isForm()
           
 boolean isLoadingLinearizedPDF()
          track if file still oaded in background
 boolean isOpen()
          see if file open - may not be open if user interrupted open or problem encountered
 boolean isPageAvailable(int rawPage)
          see if page available if in Linearized mode or return true
 boolean isPageSuccessful()
          shows if page reported any errors while printing.
 boolean isPasswordSupplied()
          show if encryption password has been supplied or set a certificate
static boolean isXMLExtraction()
          shows if text extraction is XML or pure text
static void modifyJPedalParameters(java.util.Map values)
          allow user to alter certain values in software such as Colour, If you are using decoder.getPageAsHiRes() after passing additional parameters into JPedal using the static method PdfDecoder.modifyJPedalParameters(), then getPageAsHiRes() wont necessarily be thread safe.
 void modifyNonstaticJPedalParameters(java.util.Map values)
          allow user to alter certain values in software such as Colour, Please note all Color and text highlighting values are static and common across the JVM
 void openPdfArray(byte[] data)
          routine to open a byte stream containing the PDF file and extract key info from pdf file so we can decode any pages.
 void openPdfFile(java.lang.String filename)
          routine to open PDF file and extract key info from pdf file so we can decode any pages.
 void openPdfFile(java.lang.String filename, java.security.cert.Certificate certificate, java.security.PrivateKey key)
          allow user to open file using Certificate and key
 void openPdfFile(java.lang.String filename, java.lang.String password)
          routine to open PDF file and extract key info from pdf file so we can decode any pages which also sets password.
 boolean openPdfFileFromInputStream(java.io.InputStream is, boolean supportLinearized)
          routine to open PDF file via InputStream and extract key info from pdf file so we can decode any pages - Does not actually decode the pages themselves -

You must explicitly close any open files with closePdfFile() to Java will not release all the memory IMPORTANT NOTE: If the stream does not contain enough bytes, test for Linearization may fail If boolean supportLinearized is true, method will return with true value once Linearized part read (we recommend use you false unless you know exactly what you are doing)

 boolean openPdfFileFromURL(java.lang.String pdfUrl, boolean supportLinearized)
          routine to open PDF file via URL and extract key info from pdf file so we can decode any pages - Does not actually decode the pages themselves - Also reads the form data - Based on an idea by Peter Jacobsen
You must explicitly close any open files with closePdfFile() so Java will release all the memory
If boolean supportLinearized is true, method will return with true value once Linearized part read
 void paint(java.awt.Graphics g)
           
 void paintComponent(java.awt.Graphics g)
          standard method to draw page and any highlights onto JPanel
 boolean PDFContainsEmbeddedFonts()
          shows if whole document contains embedded fonts and uses them
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int page)
          Implements the standard Java printing functionality.
 void printAdditionalObjectsOverAllPages(int[] type, java.awt.Color[] colors, java.lang.Object[] obj)
          store objects to use on a print
 void printAdditionalObjectsOverPage(int page, int[] type, java.awt.Color[] colors, java.lang.Object[] obj)
          store objects to use on a print
 void renderPageOntoGraphics2D(float scaling, int pageIndex, java.awt.Graphics2D g2, boolean useSwingThread)
          put page onto G2 useSwingThread should be true unless you are using it on a server
 void resetCurrentPrintPage()
           
 void resetForNonPDFPage()
          used for non-PDF files to reset page
 void resetViewableArea()
          turns off the viewable area, scaling the page back to original scaling

NOT RECOMMENDED FOR GENERAL USE (this has been added for a specific client and we have found it can be unpredictable on some PDF files).
 void scrollRectToVisible(java.awt.Rectangle area)
           
 void setAllowDifferentPrintPageSizes(boolean allowDifferentPrintPageSizes)
          allow printing of different sizes pages (default is false as PrintJob does not support different page sizes whereas DocPrintJob does)
 void setDisplayView(int displayView, int orientation)
          set view mode used in panel and redraw in new mode SINGLE_PAGE,CONTINUOUS,FACING,CONTINUOUS_FACING delay is the time in milli-seconds which scrolling can stop before background page drawing starts Multipage views not in OS releases
 void setEncryptionPassword(java.lang.String password)
          set a password for encryption - software will resolve if user or owner password- calls verifyAccess() from 2.74 so no separate call needed
 void setExtractionMode(int mode)
          set extraction mode telling JPedal what to extract - (TEXT,RAWIMAGES,FINALIMAGES - add together to combine) - See org.jpedal.examples for specific extraction examples
 void setExtractionMode(int mode, int imageDpi, float scaling)
          Please do not use for general usage.
 void setHardwareAccelerationforScreen(boolean useAcceleration)
          Enables/Disables hardware acceleration of screen rendering in 1.4 (default is on)
 void setInset(int width, int height)
          set an inset display so that display will not touch edge of panel
 void setJavaScriptUsed(boolean jsEnabled)
          use this to turn javascript on and off, default is on.
 void setObjectStore(ObjectStore newStore)
          return object which provides access to file images and name (use not recommended)
 void setPageCount(int numPages)
           
 void setPageData(PdfPageData pageData)
          used by remote printing to pass in page metrics
 void setPageDecodeStatus(int status, java.lang.Object value)
          allow user to set certain paramters - only supports DecodeStatus.Timeout at present
 void setPageFormat(int p, java.awt.print.PageFormat pf)
          set pageformat for a specific page - if no pageFormat is set a default will be used.
 void setPageFormat(java.awt.print.PageFormat pf)
          set pageformat for a specific page - if no pageFormat is set a default will be used.
 void setPageMode(int mode)
           
 void setPageParameters(float scaling, int pageNumber)
          initialise panel and set size to fit PDF page
intializes display with rotation set to the default, specified in the PDF document scaling value of -1 means keep existing setting
 void setPageParameters(float scaling, int pageNumber, int newRotation)
          calls setPageParameters(scaling,pageNumber) after setting rotation to draw page
 void setPagePrintRange(int start, int end)
          set page range (inclusive) - If end is less than start it will print them backwards (invalid range will throw PdfException)
 void setPagePrintRange(javax.print.attribute.SetOfIntegerSyntax range)
          set inclusive range to print (see SilentPrint.java and SimpleViewer.java for sample print code (invalid range will throw PdfException) can take values such as new PageRanges("3,5,7-9,15");
 void setPageRotation(int newRotation)
          initialise panel and set size to display during updates and update the AffineTransform to new values
 void setPDFBorder(javax.swing.border.Border newBorder)
          set border for screen and print which will be displayed
Setting a new value will enable screen and border painting - disable with disableBorderForPrinting()
 void setPDFCursor(java.awt.Cursor c)
          Override setCursor so that we can turn on and off
 void setPrintAutoRotateAndCenter(boolean value)
          set print mode (Matches Abodes Auto Print and rotate output
 void setPrintCurrentView(boolean value)
           
 void setPrintPageMode(int mode)
          allow user to select only odd or even pages to print
 void setPrintPageScalingMode(int pageScalingMode)
          set page scaling mode to use - default setting is PAGE_SCALING_REDUCE_TO_PRINTER_MARGINS All values start PAGE_SCALING
 void setRenderMode(int mode)
          set render mode to state what is displayed onscreen (ie RENDERTEXT,RENDERIMAGES) - only generally required if you do not wish to show all objects on screen (default is all).
 void setScrollInterval(int scrollInterval)
          set amount to scroll window by when scrolling
 void setStatusBarObject(StatusBar statusBar)
          set status bar to use when decoding a page - StatusBar provides a GUI object to display progress and messages.
 void setStreamCacheSize(int size)
          allows user to cache large objects to disk to avoid memory issues, setting minimum size in bytes (of uncompressed stream) above which object will be stored on disk if possible (default is -1 bytes which is all objects stored in memory) - Must be set before file opened.
 void setTextPrint(int textPrint)
          tells program to try and use Java's font printing if possible as work around for issue with PCL printing - values are PdfDecoder.TEXTGLYPHPRINT (use Java to rasterize font if available) PdfDecoder.TEXTSTRINGPRINT( print as text not raster - fastest option) PdfDecoder.NOTEXTPRINT (default - highest quality)
 void setUsePDFPaperSize(boolean usePDFPaperSize)
           
 void setUserOffsets(int x, int y, int mode)
          allow user to 'move' display of PDF mode is a Constant in org.jpedal.external.OffsetOptions (ie OffsetOptions.SWING_DISPLAY,OffsetOptions.PRINTING)
 java.awt.geom.AffineTransform setViewableArea(java.awt.Rectangle viewport)
          allows the user to create a viewport within the displayed page, the aspect ratio is keep for the PDF page

Passing in a null value is the same as calling resetViewableArea()



The viewport works from the bottom left of the PDF page
The general formula is
(leftMargin,
bottomMargin,
pdfWidth-leftMargin-rightMargin,
pdfHeight-bottomMargin-topMargin)



NOT RECOMMENDED FOR GENERAL USE (this has been added for a specific client and we have found it can be unpredictable on some PDF files).

 void stopPrinting()
          ask JPedal to stop printing a page
 void unsetScaling()
           
 void updateCursorBoxOnScreen(java.awt.Rectangle newOutlineRectangle, java.awt.Color outlineColor)
          update rectangle we draw to highlight an area - See SimpleViewer example for example code showing current usage.
 void useHiResScreenDisplay(boolean value)
          uses hires images to create a higher quality display - downside is it is slower and uses more memory (default is false).- Does nothing in OS version
 void useLogicalPrintOffset(int pagesPrinted)
          If you are printing PDFs using JPedal in your custom code, you may find pages missing, because JPedal does not know about these additional pages.
static void useTextExtraction()
          XML extraction is the default - pure text extraction is much faster
static void useXMLExtraction()
          XML extraction is the default - pure text extraction is much faster
 void waitForDecodingToFinish()
          wait for decoding to finish
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
// public static final String version = "4.70b22-OS"; /

See Also:
Constant Field Values

Helper

public static JPedalHelper Helper

useNewGraphicsMode

public boolean useNewGraphicsMode

showMouseBox

public static boolean showMouseBox

highlightColor

public static java.awt.Color highlightColor
The colour of the highlighting box around the text


pageColor

public java.awt.Color pageColor
page colour for PDF background


nonDrawnPageColor

public java.awt.Color nonDrawnPageColor

backgroundColor

public static java.awt.Color backgroundColor
The colour of the text once highlighted


highlightComposite

public static float highlightComposite
The transparency of the highlighting box around the text stored as a float


displayRotation

public int displayRotation
used by setPageParameters to draw rotated pages


pageNumber

public int pageNumber
current page


objectStoreRef

public ObjectStore objectStoreRef
the ObjectStore for this file


isRunningOnMac

public static boolean isRunningOnMac
flag to show if on mac so we can code around certain bugs


isRunningOnWindows

public static boolean isRunningOnWindows

isRunningOnAIX

public static boolean isRunningOnAIX

isRunningOnLinux

public static boolean isRunningOnLinux

javaVersion

public static float javaVersion
version number


isDraft

public static boolean isDraft

dpi

public static int dpi
dpi for final images


embedWidthData

public static boolean embedWidthData
flag to tell software to embed x point after each character so we can merge any overlapping text together


allowChangeCursor

public static boolean allowChangeCursor
Flag if we should allow cursor to change


inDemo

public static final boolean inDemo
id demo flag disables output in demo

See Also:
Constant Field Values

legacyPrintMode

public boolean legacyPrintMode

TEXT

public static final int TEXT
flag to show extraction mode includes any text

See Also:
Constant Field Values

RAWIMAGES

public static final int RAWIMAGES
flag to show extraction mode includes original images

See Also:
Constant Field Values

FINALIMAGES

public static final int FINALIMAGES
flag to show extraction mode includes final scaled/clipped

See Also:
Constant Field Values

RAWCOMMANDS

public static final int RAWCOMMANDS
flag to show extraction mode includes final scaled/clipped

See Also:
Constant Field Values

CLIPPEDIMAGES

public static final int CLIPPEDIMAGES
flag to show extraction of clipped images at highest res

See Also:
Constant Field Values

TEXTCOLOR

public static final int TEXTCOLOR
flag to show extraction of clipped images at highest res

See Also:
Constant Field Values

CMYKIMAGES

public static final int CMYKIMAGES
flag to show extraction of raw cmyk images

See Also:
Constant Field Values

XFORMMETADATA

public static final int XFORMMETADATA
flag to show extraction of xforms metadata

See Also:
Constant Field Values

COLOR

public static final int COLOR
flag to show extraction of color required (used in Storypad grouping)

See Also:
Constant Field Values

RENDERTEXT

public static final int RENDERTEXT
flag to show render mode includes any text

See Also:
Constant Field Values

RENDERIMAGES

public static final int RENDERIMAGES
flag to show render mode includes any images

See Also:
Constant Field Values

REMOVE_RENDERSHAPES

public static final int REMOVE_RENDERSHAPES
flag to show render mode includes any images

See Also:
Constant Field Values

OCR_PDF

public static final int OCR_PDF
flag to show text highlights need to be done last

See Also:
Constant Field Values

NOTEXTPRINT

public static final int NOTEXTPRINT
printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS) - this is the default off setting

See Also:
Constant Field Values

TEXTGLYPHPRINT

public static final int TEXTGLYPHPRINT
printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS)

See Also:
Constant Field Values

TEXTSTRINGPRINT

public static final int TEXTSTRINGPRINT
printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS)

See Also:
Constant Field Values

STANDARDTEXTSTRINGPRINT

public static final int STANDARDTEXTSTRINGPRINT
printing mode using inbuilt java fonts and getting java to rasterize fonts using Java font if match found (added to get around limitations in PCL printing via JPS) - overrides embedded fonts for standard fonts (ie Arial)

See Also:
Constant Field Values

SUBSTITUTE_FONT_USING_FILE_NAME

public static final int SUBSTITUTE_FONT_USING_FILE_NAME
See Also:
Constant Field Values

SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME

public static final int SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME
See Also:
Constant Field Values

SUBSTITUTE_FONT_USING_FAMILY_NAME

public static final int SUBSTITUTE_FONT_USING_FAMILY_NAME
See Also:
Constant Field Values

SUBSTITUTE_FONT_USING_FULL_FONT_NAME

public static final int SUBSTITUTE_FONT_USING_FULL_FONT_NAME
See Also:
Constant Field Values

SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME_USE_FAMILY_NAME_IF_DUPLICATES

public static final int SUBSTITUTE_FONT_USING_POSTSCRIPT_NAME_USE_FAMILY_NAME_IF_DUPLICATES
See Also:
Constant Field Values

showErrorMessages

public static boolean showErrorMessages
flag to enable popup of error messages in JPedal

Constructor Detail

PdfDecoder

public PdfDecoder(boolean newRender)
Recommend way to create a PdfDecoder if no rendering of page may be required
Otherwise use PdfDecoder()

Parameters:
newRender - flag to show if pages being rendered for JPanel or extraction

PdfDecoder

public PdfDecoder()
Recommend way to create a PdfDecoder for renderer only viewer (not recommended for server extraction only processes)

Method Detail

getPageFromObjectRef

public int getPageFromObjectRef(java.lang.String ref)
given a ref, what is the page

Parameters:
ref - - PDF object reference
Returns:
- page number with being first page

isOpen

public boolean isOpen()
see if file open - may not be open if user interrupted open or problem encountered


getMarkedContent

public org.w3c.dom.Document getMarkedContent()
return markedContent object as XML Document

Returns:
Document containing XML structure with data

setPageData

public void setPageData(PdfPageData pageData)
used by remote printing to pass in page metrics

Parameters:
pageData -

getlastPageDecoded

public int getlastPageDecoded()
return page number for last page decoded (only use in SingleDisplay mode)


getPageView

public org.jpedal.render.DynamicVectorRenderer getPageView(java.lang.String currentPageOffset,
                                                           int pageNumber)

getPageInfo

public java.util.Iterator getPageInfo(int type)
return details on page for type (defined in org.jpedal.constants.PageInfo) or null if no values Unrecognised key will throw a RunTime exception null returned if JPedal not clear on result


getOutlineData

public org.jpedal.objects.outlines.OutlineData getOutlineData()
provide direct access to outlineData object

Returns:
OutlineData

isLoadingLinearizedPDF

public boolean isLoadingLinearizedPDF()
track if file still oaded in background

Returns:

resetViewableArea

public void resetViewableArea()
turns off the viewable area, scaling the page back to original scaling

NOT RECOMMENDED FOR GENERAL USE (this has been added for a specific client and we have found it can be unpredictable on some PDF files).


setViewableArea

public java.awt.geom.AffineTransform setViewableArea(java.awt.Rectangle viewport)
                                              throws PdfException
allows the user to create a viewport within the displayed page, the aspect ratio is keep for the PDF page

Passing in a null value is the same as calling resetViewableArea()



The viewport works from the bottom left of the PDF page
The general formula is
(leftMargin,
bottomMargin,
pdfWidth-leftMargin-rightMargin,
pdfHeight-bottomMargin-topMargin)



NOT RECOMMENDED FOR GENERAL USE (this has been added for a specific client and we have found it can be unpredictable on some PDF files).



The viewport will not be incorporated in printing

Throws PdfException if the viewport is not totally enclosed within the 100% cropped pdf

Throws:
PdfException

getPageAlignment

public int getPageAlignment()
// // /** return type of alignment for pages if smaller than panel - see options in Display class.


init

public static void init(boolean newEmbedWidthData)
This will be needed for text extraction as it paramter makes sure widths included in text stream

Parameters:
newEmbedWidthData - - flag to embed width data in text fragments for use by grouping algorithms

disposeAllStatic

public static void disposeAllStatic()
remove all static elements - only do once completely finished with JPedal as will not be reinitialised


dispose

public final void dispose()
convenience method to remove all items from memory If you wish to clear all static objects as well, you will also need to call disposeAllStatic()


closePdfFile

public final void closePdfFile()
convenience method to close the current PDF file


getPdfBackgroundData

public final org.jpedal.objects.PdfData getPdfBackgroundData()
Access should not generally be required to this class. Please look at getBackgroundGroupingObject() - provide method for outside class to get data object containing text and metrics of text. - Viewer can only access data for finding on page

Returns:
PdfData object containing text content from PDF

getPdfData

public final org.jpedal.objects.PdfData getPdfData()
                                            throws PdfException
Access should not generally be required to this class. Please look at getGroupingObject() - provide method for outside class to get data object containing raw text and metrics of text
- Viewer can only access data for finding on page

Returns:
PdfData object containing text content from PDF
Throws:
PdfException

hasOutline

public final boolean hasOutline()
flag to show if PDF document contains an outline


getOutlineAsXML

public final org.w3c.dom.Document getOutlineAsXML()
return a DOM document containing the PDF Outline object as a DOM Document - may return null


getPdfPageData

public final PdfPageData getPdfPageData()
Provides method for outside class to get data object containing information on the page for calculating grouping
Please note: Structure of PdfPageData is not guaranteed to remain constant. Please contact IDRsolutions for advice.

Returns:
PdfPageData object

setPagePrintRange

public void setPagePrintRange(int start,
                              int end)
                       throws PdfException
set page range (inclusive) - If end is less than start it will print them backwards (invalid range will throw PdfException)

Throws:
PdfException

setTextPrint

public void setTextPrint(int textPrint)
tells program to try and use Java's font printing if possible as work around for issue with PCL printing - values are PdfDecoder.TEXTGLYPHPRINT (use Java to rasterize font if available) PdfDecoder.TEXTSTRINGPRINT( print as text not raster - fastest option) PdfDecoder.NOTEXTPRINT (default - highest quality)


setJavaScriptUsed

public void setJavaScriptUsed(boolean jsEnabled)
use this to turn javascript on and off, default is on.


useLogicalPrintOffset

public void useLogicalPrintOffset(int pagesPrinted)
If you are printing PDFs using JPedal in your custom code, you may find pages missing, because JPedal does not know about these additional pages. This method allows you to tell JPedal you have already printed pagesPrinted


print

public int print(java.awt.Graphics graphics,
                 java.awt.print.PageFormat pageFormat,
                 int page)
          throws java.awt.print.PrinterException
Implements the standard Java printing functionality.

Specified by:
print in interface java.awt.print.Printable
Parameters:
graphics - the context into which the page is drawn
pageFormat - the size and orientation of the page being drawn
page - the zero based index of the page to be drawn
Returns:
int Printable.PAGE_EXISTS or Printable.NO_SUCH_PAGE
Throws:
java.awt.print.PrinterException

getPageAsHiRes

public java.awt.image.BufferedImage getPageAsHiRes(int pageIndex)
                                            throws PdfException
Parameters:
pageIndex - number of the page we want to extract
Returns:
image of the extracted page
Throws:
PdfException - Page size is defined by CropBox see http://www.jpedal.org/gplSrc/org/jpedal/examples/images/HiResThumbnailExtractor.java.html for full details

getPageAsHiRes

public java.awt.image.BufferedImage getPageAsHiRes(int pageIndex,
                                                   java.util.Map params)
                                            throws PdfException
Parameters:
pageIndex - number of the page we want to extract
params - list of values to override static settings in modifyJPedalParameters for this instance only
Returns:
image of the extracted page
Throws:
PdfException - Page size is defined by CropBox see http://www.jpedal.org/gplSrc/org/jpedal/examples/images/HiResThumbnailExtractor.java.html for full details

getPageAsHiRes

public java.awt.image.BufferedImage getPageAsHiRes(int pageIndex,
                                                   java.util.Map params,
                                                   boolean isTransparent)
                                            throws PdfException
Parameters:
pageIndex - number of the page we want to extract
params - list of values to override static settings in modifyJPedalParameters for this instance only
isTransparent - - set if transparent or has background
Returns:
image of the extracted page
Throws:
PdfException - Page size is defined by CropBox see http://www.jpedal.org/gplSrc/org/jpedal/examples/images/HiResThumbnailExtractor.java.html for full details

getPageAsHiRes

public java.awt.image.BufferedImage getPageAsHiRes(int pageIndex,
                                                   boolean isTransparent)
                                            throws PdfException
Parameters:
pageIndex - number of the page we want to extract
Returns:
image of the extracted page
Throws:
PdfException - Page size is defined by CropBox see http://www.jpedal.org/gplSrc/org/jpedal/examples/images/HiResThumbnailExtractor.java.html for full details

getPageAsImage

public java.awt.image.BufferedImage getPageAsImage(int pageIndex)
                                            throws PdfException
generate BufferedImage of a page in current file Page size is defined by CropBox

Throws:
PdfException

getPageAsTransparentImage

public java.awt.image.BufferedImage getPageAsTransparentImage(int pageIndex)
                                                       throws PdfException
generate BufferedImage of a page in current file

Throws:
PdfException

renderPageOntoGraphics2D

public void renderPageOntoGraphics2D(float scaling,
                                     int pageIndex,
                                     java.awt.Graphics2D g2,
                                     boolean useSwingThread)
                              throws java.lang.Exception
put page onto G2 useSwingThread should be true unless you are using it on a server

Throws:
java.lang.Exception

getHiResUpscaleFactor

public float getHiResUpscaleFactor()
return scaleup factor applied to last Hires image of page generated negative values mean no upscaling applied and should be ignored


flushObjectValues

public final void flushObjectValues(boolean reinit)
provide method for outside class to clear store of objects once written out to reclaim memory

Parameters:
reinit - lag to show if image data flushed as well

getPdfImageData

public final PdfImageData getPdfImageData()
provide method for outside class to get data object containing images

Returns:
PdfImageData containing image metadata

getPdfBackgroundImageData

public final PdfImageData getPdfBackgroundImageData()
provide method for outside class to get data object containing images.

Returns:
PdfImageData containing image metadata

setRenderMode

public final void setRenderMode(int mode)
set render mode to state what is displayed onscreen (ie RENDERTEXT,RENDERIMAGES) - only generally required if you do not wish to show all objects on screen (default is all). Add values together to combine settings.


setExtractionMode

public final void setExtractionMode(int mode)
set extraction mode telling JPedal what to extract - (TEXT,RAWIMAGES,FINALIMAGES - add together to combine) - See org.jpedal.examples for specific extraction examples


modifyNonstaticJPedalParameters

public void modifyNonstaticJPedalParameters(java.util.Map values)
                                     throws PdfException
allow user to alter certain values in software such as Colour, Please note all Color and text highlighting values are static and common across the JVM

Throws:
PdfException

modifyJPedalParameters

public static void modifyJPedalParameters(java.util.Map values)
                                   throws PdfException
allow user to alter certain values in software such as Colour, If you are using decoder.getPageAsHiRes() after passing additional parameters into JPedal using the static method PdfDecoder.modifyJPedalParameters(), then getPageAsHiRes() wont necessarily be thread safe. If you want to use getPageAsHiRes() and pass in additional parameters, in a thread safe mannor, please use the method getPageAsHiRes(int pageIndex, Map params) or getPageAsHiRes(int pageIndex, Map params, boolean isTransparent) and pass the additional parameters in directly to the getPageAsHiRes() method without calling PdfDecoder.modifyJPedalParameters() first. Please see http://www.jpedal.org/support_egHiRes.php for more details on how to use HiResThumbnailExtraction. Please note all Color and text highlighting values except page colour are static and common across the JVM

Throws:
PdfException

getFileInformationData

public final PdfFileInformation getFileInformationData()
method to return null or object giving access info fields and metadata.


setExtractionMode

public final void setExtractionMode(int mode,
                                    int imageDpi,
                                    float scaling)
Please do not use for general usage. Use setPageParameters(scalingValue, pageNumber) instead;


getDPIFactory

public DPIFactory getDPIFactory()
return handle on PDFFactory which adjusts display size so matches size in Acrobat

Returns:

setPageParameters

public final void setPageParameters(float scaling,
                                    int pageNumber)
initialise panel and set size to fit PDF page
intializes display with rotation set to the default, specified in the PDF document scaling value of -1 means keep existing setting


setPageParameters

public final void setPageParameters(float scaling,
                                    int pageNumber,
                                    int newRotation)
calls setPageParameters(scaling,pageNumber) after setting rotation to draw page


setStatusBarObject

public void setStatusBarObject(StatusBar statusBar)
set status bar to use when decoding a page - StatusBar provides a GUI object to display progress and messages.


waitForDecodingToFinish

public void waitForDecodingToFinish()
wait for decoding to finish


getDynamicRenderer

public org.jpedal.render.DynamicVectorRenderer getDynamicRenderer()
gets DynamicVector Object


getDynamicRenderer

public org.jpedal.render.DynamicVectorRenderer getDynamicRenderer(boolean reset)
gets DynamicVector Object - NOT PART OF API and subject to change (DO NOT USE)


decodePageForMarkedContent

public final void decodePageForMarkedContent(int pageNumber,
                                             org.jpedal.objects.raw.PdfObject pdfObject,
                                             java.lang.Object pageStream)
                                      throws java.lang.Exception
extract marked content - not yet live

Throws:
java.lang.Exception

setPDFCursor

public void setPDFCursor(java.awt.Cursor c)
Override setCursor so that we can turn on and off


decodePage

public final void decodePage(int rawPage)
                      throws java.lang.Exception
decode a page, - page must be between 1 and PdfDecoder.getPageCount() - Will kill off if already running returns minus page if trying to open linearized page not yet available

Throws:
java.lang.Exception

isPageAvailable

public boolean isPageAvailable(int rawPage)
see if page available if in Linearized mode or return true

Parameters:
rawPage -
Returns:

printAdditionalObjectsOverPage

public void printAdditionalObjectsOverPage(int page,
                                           int[] type,
                                           java.awt.Color[] colors,
                                           java.lang.Object[] obj)
                                    throws PdfException
store objects to use on a print

Parameters:
page -
type -
colors -
obj -
Throws:
PdfException

printAdditionalObjectsOverAllPages

public void printAdditionalObjectsOverAllPages(int[] type,
                                               java.awt.Color[] colors,
                                               java.lang.Object[] obj)
                                        throws PdfException
store objects to use on a print

Parameters:
type -
colors -
obj -
Throws:
PdfException

drawAdditionalObjectsOverPage

public void drawAdditionalObjectsOverPage(int page,
                                          int[] type,
                                          java.awt.Color[] colors,
                                          java.lang.Object[] obj)
                                   throws PdfException
allow user to add grapical content on top of page - for display ONLY Additional calls will overwrite current settings on page ONLY works in SINGLE VIEW displaymode

Throws:
PdfException

flushAdditionalObjectsOnPage

public void flushAdditionalObjectsOnPage(int page)
                                  throws PdfException
allow user to remove all additional grapical content from the page (only for display) ONLY works in SINGLE VIEW displaymode

Throws:
PdfException

useHiResScreenDisplay

public void useHiResScreenDisplay(boolean value)
uses hires images to create a higher quality display - downside is it is slower and uses more memory (default is false).- Does nothing in OS version

Parameters:
value -

decodePageInBackground

public final void decodePageInBackground(int i)
                                  throws java.lang.Exception
decode a page as a background thread (use other background methods to access data) we now recommend you use decodePage as this has been heavily optimised for speed

Throws:
java.lang.Exception

getPageCount

public final int getPageCount()
get page count of current PDF file


isEncrypted

public final boolean isEncrypted()
return true if the current pdf file is encrypted
check isFileViewable(),

if file is encrypted and not viewable - a user specified password is needed.


isPasswordSupplied

public final boolean isPasswordSupplied()
show if encryption password has been supplied or set a certificate


isFileViewable

public boolean isFileViewable()
show if encrypted file can be viewed,
if false a password needs entering


isExtractionAllowed

public boolean isExtractionAllowed()
show if content can be extracted


setEncryptionPassword

public final void setEncryptionPassword(java.lang.String password)
                                 throws PdfException
set a password for encryption - software will resolve if user or owner password- calls verifyAccess() from 2.74 so no separate call needed

Throws:
PdfException

openPdfArray

public final void openPdfArray(byte[] data)
                        throws PdfException
routine to open a byte stream containing the PDF file and extract key info from pdf file so we can decode any pages. Does not actually decode the pages themselves - By default files over 16384 bytes are cached to disk but this can be altered by setting PdfFileReader.alwaysCacheInMemory to a maximimum size or -1 (always keep in memory)

Throws:
PdfException

openPdfFile

public void openPdfFile(java.lang.String filename,
                        java.security.cert.Certificate certificate,
                        java.security.PrivateKey key)
                 throws PdfException
allow user to open file using Certificate and key

Parameters:
filename -
certificate -
key -
Throws:
PdfException

openPdfFile

public final void openPdfFile(java.lang.String filename)
                       throws PdfException
routine to open PDF file and extract key info from pdf file so we can decode any pages. Does not actually decode the pages themselves. Also reads the form data. You must explicitly close any open files with closePdfFile() to Java will not release all the memory

Throws:
PdfException

openPdfFile

public final void openPdfFile(java.lang.String filename,
                              java.lang.String password)
                       throws PdfException
routine to open PDF file and extract key info from pdf file so we can decode any pages which also sets password. Does not actually decode the pages themselves. Also reads the form data. You must explicitly close any open files with closePdfFile() or Java will not release all the memory

Throws:
PdfException

openPdfFileFromURL

public final boolean openPdfFileFromURL(java.lang.String pdfUrl,
                                        boolean supportLinearized)
                                 throws PdfException
routine to open PDF file via URL and extract key info from pdf file so we can decode any pages - Does not actually decode the pages themselves - Also reads the form data - Based on an idea by Peter Jacobsen
You must explicitly close any open files with closePdfFile() so Java will release all the memory
If boolean supportLinearized is true, method will return with true value once Linearized part read

Throws:
PdfException

openPdfFileFromInputStream

public final boolean openPdfFileFromInputStream(java.io.InputStream is,
                                                boolean supportLinearized)
                                         throws PdfException
routine to open PDF file via InputStream and extract key info from pdf file so we can decode any pages - Does not actually decode the pages themselves -

You must explicitly close any open files with closePdfFile() to Java will not release all the memory IMPORTANT NOTE: If the stream does not contain enough bytes, test for Linearization may fail If boolean supportLinearized is true, method will return with true value once Linearized part read (we recommend use you false unless you know exactly what you are doing)

Throws:
PdfException

getJPedalObject

public java.lang.Object getJPedalObject(int id)
will return some dictionary values - if not a set value, will return null

Returns:

setPageMode

public void setPageMode(int mode)

isXMLExtraction

public static boolean isXMLExtraction()
shows if text extraction is XML or pure text


useTextExtraction

public static void useTextExtraction()
XML extraction is the default - pure text extraction is much faster


useXMLExtraction

public static void useXMLExtraction()
XML extraction is the default - pure text extraction is much faster


clearScreen

public void clearScreen()
remove all displayed objects for JPanel display (wipes current page)


setStreamCacheSize

public void setStreamCacheSize(int size)
allows user to cache large objects to disk to avoid memory issues, setting minimum size in bytes (of uncompressed stream) above which object will be stored on disk if possible (default is -1 bytes which is all objects stored in memory) - Must be set before file opened.


hasEmbeddedFonts

public boolean hasEmbeddedFonts()
shows if embedded fonts present on page just decoded


PDFContainsEmbeddedFonts

public final boolean PDFContainsEmbeddedFonts()
                                       throws java.lang.Exception
shows if whole document contains embedded fonts and uses them

Throws:
java.lang.Exception

getInfo

public java.lang.String getInfo(int type)
Returns list of the fonts used on the current page decoded or null type can be PdfDictionary.Font or PdfDictionary.Image


getFormRenderer

public org.jpedal.objects.acroforms.rendering.AcroRenderer getFormRenderer()
Allow user to access Forms renderer - returns null not available (should not generally be needed)


isPageSuccessful

public boolean isPageSuccessful()
shows if page reported any errors while printing. Log can be found with getPageFailureMessage()

Returns:
Returns the printingSuccessful.

getPageDecodeReport

public java.lang.String getPageDecodeReport()
return any errors or other messages while calling decodePage() - zero length is no problems


getPageFailureMessage

public java.lang.String getPageFailureMessage()
Return String with all error messages from last printed (useful for debugging)


getSelectedRectangleOnscreen

public java.awt.image.BufferedImage getSelectedRectangleOnscreen(float t_x1,
                                                                 float t_y1,
                                                                 float t_x2,
                                                                 float t_y2,
                                                                 float scaling)
If running in GUI mode, will extract a section of rendered page as BufferedImage -coordinates are PDF co-ordinates. If you wish to use hires image, you will need to enable hires image display with decode_pdf.useHiResScreenDisplay(true);

Parameters:
t_x1 -
t_y1 -
t_x2 -
t_y2 -
scaling -
Returns:
pageErrorMessages - Any printer errors

getObjectStore

public ObjectStore getObjectStore()
return object which provides access to file images and name


setObjectStore

public void setObjectStore(ObjectStore newStore)
return object which provides access to file images and name (use not recommended)


getGroupingObject

public PdfGroupingAlgorithms getGroupingObject()
                                        throws PdfException
returns object containing grouped text of last decoded page - if no page decoded, a Runtime exception is thrown to warn user Please see org.jpedal.examples.text for example code.

Throws:
PdfException

getBackgroundGroupingObject

public PdfGroupingAlgorithms getBackgroundGroupingObject()
returns object containing grouped text from background grouping - Please see org.jpedal.examples.text for example code


getPDFVersion

public final java.lang.String getPDFVersion()
get PDF version in file


resetForNonPDFPage

public void resetForNonPDFPage()
used for non-PDF files to reset page


setDisplayView

public void setDisplayView(int displayView,
                           int orientation)
set view mode used in panel and redraw in new mode SINGLE_PAGE,CONTINUOUS,FACING,CONTINUOUS_FACING delay is the time in milli-seconds which scrolling can stop before background page drawing starts Multipage views not in OS releases


hasJavascript

public boolean hasJavascript()
show if page is an XFA form


hasAllImages

public boolean hasAllImages()
flag to show if we suspect problem with some images


setPageDecodeStatus

public void setPageDecodeStatus(int status,
                                java.lang.Object value)
allow user to set certain paramters - only supports DecodeStatus.Timeout at present

Parameters:
status -
value -

getPageDecodeStatus

public boolean getPageDecodeStatus(int status)

getPageDecodeStatusReport

public java.lang.String getPageDecodeStatusReport(int status)
get page statuses


setPrintAutoRotateAndCenter

public void setPrintAutoRotateAndCenter(boolean value)
set print mode (Matches Abodes Auto Print and rotate output


setPrintCurrentView

public void setPrintCurrentView(boolean value)

addExternalHandler

public void addExternalHandler(java.lang.Object newHandler,
                               int type)
allows external helper classes to be added to JPedal to alter default functionality - not part of the API and should be used in conjunction with IDRsolutions only
if Options.FormsActionHandler is the type then the newHandler should be of the form org.jpedal.objects.acroforms.ActionHandler

Parameters:
newHandler -
type -

getExternalHandler

public java.lang.Object getExternalHandler(int type)
allows external helper classes to be accessed if needed - also allows user to access SwingGUI if running full Viewer package - not all Options available to get - please contact IDRsolutions if you are looking to use

Parameters:
type -

unsetScaling

public void unsetScaling()

getFormDataForField

public java.lang.Object[] getFormDataForField(java.lang.String formName)
return PDF data object or Objects for field containing values from PDF file This will take either the Name or the PDFref (ie Box or 12 0 R) This can return an object[] if Box is a radio button with multiple vales so you need to check instanceof Object[] on data In the case of a PDF with radio buttons Box (12 0 R), Box (13 0 R), Box (14 0 R) getFormDataAsObject(Box) would return an Object which is actually Object[3] getFormDataAsObject(12 0 R) would return an Object which is a single value


getNamesForAllFields

public java.util.Set getNamesForAllFields()
                                   throws PdfException
return full list of Fields for Annots and Forms

Throws:
PdfException

getIO

public org.jpedal.io.PdfObjectReader getIO()

setPageCount

public void setPageCount(int numPages)

getFileName

public java.lang.String getFileName()

isForm

public boolean isForm()

getReferenceforPage

public java.lang.String getReferenceforPage(int page)
reference for Page object

Parameters:
page -
Returns:
String ref (ie 1 0 R) pdfObject=new PageObject(currentPageOffset); currentPdfFile.readObject(pdfObject);

getPrintable

public java.awt.print.Printable getPrintable(int page)
                                      throws java.lang.IndexOutOfBoundsException
part of pageable interface

Specified by:
getPrintable in interface java.awt.print.Pageable
Throws:
java.lang.IndexOutOfBoundsException
See Also:
Pageable.getPrintable(int)

setAllowDifferentPrintPageSizes

public void setAllowDifferentPrintPageSizes(boolean allowDifferentPrintPageSizes)
allow printing of different sizes pages (default is false as PrintJob does not support different page sizes whereas DocPrintJob does)

Parameters:
allowDifferentPrintPageSizes -

getTextLines

public org.jpedal.text.TextLines getTextLines()
access textlines object


setInset

public final void setInset(int width,
                           int height)
set an inset display so that display will not touch edge of panel


ensurePointIsVisible

public void ensurePointIsVisible(java.awt.Point p)
make screen scroll to ensure point is visible


setUserOffsets

public void setUserOffsets(int x,
                           int y,
                           int mode)
allow user to 'move' display of PDF mode is a Constant in org.jpedal.external.OffsetOptions (ie OffsetOptions.SWING_DISPLAY,OffsetOptions.PRINTING)


getUserOffsets

public java.awt.Point getUserOffsets(int mode)

getMaximumSize

public final java.awt.Dimension getMaximumSize()
get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set (ie a PDF size 800 * 600 with a scaling factor of 2 will return 1600 *1200)

Overrides:
getMaximumSize in class javax.swing.JComponent

getMinimumSize

public final java.awt.Dimension getMinimumSize()
get width

Overrides:
getMinimumSize in class javax.swing.JComponent

getPreferredSize

public java.awt.Dimension getPreferredSize()
get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set (ie a PDF size 800 * 600 with a scaling factor of 2 will return 1600 *1200)

Overrides:
getPreferredSize in class javax.swing.JComponent

updateCursorBoxOnScreen

public final void updateCursorBoxOnScreen(java.awt.Rectangle newOutlineRectangle,
                                          java.awt.Color outlineColor)
update rectangle we draw to highlight an area - See SimpleViewer example for example code showing current usage.


paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class javax.swing.JComponent

paintComponent

public void paintComponent(java.awt.Graphics g)
standard method to draw page and any highlights onto JPanel

Overrides:
paintComponent in class javax.swing.JComponent

getPDFWidth

public final int getPDFWidth()
get sizes of panel
This is the PDF pagesize (as set in the PDF from pagesize) - It now includes any scaling factor you have set


getPDFHeight

public final int getPDFHeight()
get sizes of panel - This is the PDF pagesize


setPDFBorder

public final void setPDFBorder(javax.swing.border.Border newBorder)
set border for screen and print which will be displayed
Setting a new value will enable screen and border painting - disable with disableBorderForPrinting()


setPageRotation

public final void setPageRotation(int newRotation)
initialise panel and set size to display during updates and update the AffineTransform to new values


setHardwareAccelerationforScreen

public void setHardwareAccelerationforScreen(boolean useAcceleration)
Enables/Disables hardware acceleration of screen rendering in 1.4 (default is on)


getScrollInterval

public int getScrollInterval()
return amount to scroll window by when scrolling (default is 10)


setScrollInterval

public void setScrollInterval(int scrollInterval)
set amount to scroll window by when scrolling


getDisplayView

public int getDisplayView()
returns view mode used - ie SINGLE_PAGE,CONTINUOUS,FACING,CONTINUOUS_FACING (no effect in OS versions)


setPrintPageScalingMode

public void setPrintPageScalingMode(int pageScalingMode)
set page scaling mode to use - default setting is PAGE_SCALING_REDUCE_TO_PRINTER_MARGINS All values start PAGE_SCALING


setUsePDFPaperSize

public void setUsePDFPaperSize(boolean usePDFPaperSize)

getScaling

public float getScaling()

getInsetH

public int getInsetH()

getInsetW

public int getInsetW()

getCursorBoxOnScreen

public java.awt.Rectangle getCursorBoxOnScreen()

scrollRectToVisible

public void scrollRectToVisible(java.awt.Rectangle area)
Overrides:
scrollRectToVisible in class javax.swing.JComponent

getNumberOfPages

public int getNumberOfPages()
part of pageable interface - used only in printing Use getPageCount() for number of pages

Specified by:
getNumberOfPages in interface java.awt.print.Pageable
See Also:
Pageable.getNumberOfPages()

getPageFormat

public java.awt.print.PageFormat getPageFormat(int p)
                                        throws java.lang.IndexOutOfBoundsException
part of pageable interface

Specified by:
getPageFormat in interface java.awt.print.Pageable
Throws:
java.lang.IndexOutOfBoundsException
See Also:
Pageable.getPageFormat(int)

setPageFormat

public void setPageFormat(int p,
                          java.awt.print.PageFormat pf)
set pageformat for a specific page - if no pageFormat is set a default will be used. Recommended to use setPageFormat(PageFormat pf)


setPageFormat

public void setPageFormat(java.awt.print.PageFormat pf)
set pageformat for a specific page - if no pageFormat is set a default will be used.


setPagePrintRange

public void setPagePrintRange(javax.print.attribute.SetOfIntegerSyntax range)
                       throws PdfException
set inclusive range to print (see SilentPrint.java and SimpleViewer.java for sample print code (invalid range will throw PdfException) can take values such as new PageRanges("3,5,7-9,15");

Throws:
PdfException

setPrintPageMode

public void setPrintPageMode(int mode)
allow user to select only odd or even pages to print


stopPrinting

public final void stopPrinting()
ask JPedal to stop printing a page


getCurrentPrintPage

public int getCurrentPrintPage()
return page currently being printed or -1 if finished


resetCurrentPrintPage

public void resetCurrentPrintPage()

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org

JPedal Java PDF library 4.70b22 API Documentation - http://www.jpedal.org