JPedal Java PDF library 4.01b28 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.PdfPanel
                      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 PdfPanel
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
 
Field Summary
static int BORDER_HIDE
           
static int BORDER_SHOW
           
static boolean clipOnMac
           
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 colr required (used in Storypad grouping)
static int CURRENT_BORDER_STYLE
           
static org.jpedal.fonts.PdfHeightTable currentHeightLookupData
          lookup table to precalculated height values
static boolean debugHiRes
           
static boolean debugPrint
          provide print debug feature - used for internal development only
static java.lang.String defaultFont
          font to use in preference to Lucida
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 boolean enforceFontSubstitution
          flag to show if there must be a mapping value (program exits if none found)
static int FINALIMAGES
          flag to show extraction mode includes final scaled/clipped
static JPedalHelper Helper
           
static boolean hires
          custom hi-res val for JPedal settings
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 boolean java3DAvailable
           
static int MOUSE_MODE_PANNING
           
static int MOUSE_MODE_TEXT_SELECT
           
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
static boolean optimiseType3Rendering
           
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 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 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)
static boolean usePageFlow3D
           
static java.lang.String version
           
static int XFORMMETADATA
          flag to show extraction of xforms metadata
 
Fields inherited from class org.jpedal.PdfPanel
areas, backgroundColor, extractingAsImage, highlightColor, highlightComposite, objectStoreRef, SHOW_BOXES, SHOW_LINES, SHOW_OBJECTS, turnoverOn, useNewGraphicsMode
 
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 addAdditionalPage(org.jpedal.render.DynamicVectorRenderer dynamicRenderer, int pageWidth, int origPageWidth)
          used by Storypad to display split spreads not aprt of API
 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
static void addFontFile(java.lang.String currentFont, java.lang.String fontPath)
          method to add a single file to the PDF renderer
 void addImage(java.awt.image.BufferedImage img)
          used to display non-PDF files
 boolean addSubstituteFonts(java.lang.String fontPath, boolean enforceMapping)
          This routine allows the user to add truetype, type1 or type1C fonts which will be used to disalay the fonts in PDF rendering and substitution as if the fonts were embedded in the PDF
This is very useful for clients looking to keep down the size of PDFs transmitted and control display quality -

Thanks to Peter for the idea/code -

How to set it up -

JPedal will look for the existence of the directory fontPath (ie com/myCompany/Fonts) -

If this exists, Jpedal will look for 3 possible directories (tt,t1c,t1) and make a note of any fonts if these directories exist -

When fonts are resolved, this option will be tested first and if a font if found, it will be used to display the font (the effect will be the same as if the font was embedded) -

If the enforceMapping is true, JPedal assumes there must be a match and will throw a PdfFontException -

Otherwise Jpedal will look in the java font path for a match or approximate with Lucida -

The Format is defined as follows: -

fontname = filename

Type1/Type1C Font names exclude any prefix so /OEGPNB+FGHeavyItalic is resolved to FGHeavyItalic -

Each font have the same name as the font it replaces (so Arial will require a font file such as Arial.ttf) and it must be unique (there cannot be an Arial font in each sub-directory) -

So to use this functionality, place the fonts in a jar or add to the JPedal jar and call this method after instancing PdfDecoder - JPedal will do the rest

 void clearScreen()
          remove all displayed objects for JPanel display (wipes current page)
 void closePdfFile()
          convenience method to close the current PDF file
 void decodeOtherPages(int pageCount)
          used to decode multiple pages on views
 void decodePage(int rawPage)
          decode a page, - page must be between 1 and PdfDecoder.getPageCount() - Will kill off if already running
 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
 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 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
 int getAdditionalPageCount()
           
 PdfGroupingAlgorithms getBackgroundGroupingObject()
          returns object containing grouped text from background grouping - Please see org.jpedal.examples.text for example code
static int getBorderStyle()
           
 int getCurrentPrintPage()
          return page currently being printed or -1 if finished
 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.String getFontsInFile()
          Returns list of the fonts used on the current page decoded
static int getFontSubstitutionMode()
          set mode to use when substituting fonts (default is to use Filename (ie arial.ttf) Options are SUBSTITUTE_* values from PdfDecoder
 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 - 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
 org.jpedal.io.PdfObjectReader getIO()
          return swing widget regardless of whether it came from Annot or form
 java.util.Map getJPedalActionHandlers()
           
 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)
 PdfLayerList getLayers()
          Deprecated. - please use (PdfLayerList)getJPedalObject(PdfDictionary.Layer);
 org.w3c.dom.Document getMarkedContent()
          return markedContent object as XML Document
 int getMouseMode()
           
 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
 int getObjectUnderneath(int x, int y)
           
 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
 java.awt.Point getPageOffsets(int page)
           
 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.
 byte[] getPdfBuffer()
          convenience method to get the PDF data as a byte array - works however file was opened.
 org.jpedal.objects.PdfData getPdfData()
          Access should not generally be required to this class.
 int getPDFflag(java.lang.Integer i)
          give user access to PDF flag value - if file not open or input not valid returns -1

Possible values in PdfFLAGS

ie PDFflags.USER_ACCESS_PERMISSIONS - return P value

PDFflags.VALID_PASSWORD_SUPPLIED - tell if password supplied and if owner or user POssible values PDFflags.NO_VALID_PASSWORD, PDFflags.VALID_USER_PASSWORD, PDFflags.VALID_OWNER_PASSWORD or both USER and owner

 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
 java.awt.print.Printable getPrintable(int page)
          part of pageable interface
 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.
 int getXCordForPage(int page, float scaling)
          used internally by multiple pages scaling -1 to ignore, -2 to force reset
 int getXDisplacement()
           
 int getYCordForPage(int page, float scaling)
          used internally by multiple pages scaling -1 to ignore, -2 to force reset
 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()
           
static boolean isHires()
           
 boolean isMultiPageTiff()
           
 boolean isOpen()
          see if file open - may not be open if user interrupted open or problem encountered
 boolean isPageSuccessful()
          shows if page reported any errors while printing or being decoded.
 boolean isPasswordSupplied()
          show if encryption password has been supplied
 boolean isPDF()
           
 boolean isPDFLinearized(java.lang.String pdfUrl)
          examine first few bytes to see if linearized and return true linearized file
 boolean isThumbnailsDrawing()
           
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 cntaining 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.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 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() to Java will not release all the memory If boolean supportLinearized is true, method will return with true value once Linearized part read

 boolean PDFContainsEmbeddedFonts()
          shows if whole document contains embedded fonts and uses them
 int print(java.awt.Graphics graphics, java.awt.print.PageFormat pf, int page)
          implements the standard Java printing functionality if start
 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)
          put page onto G2
 void resetCurrentPrintPage()
           
 void resetFormsForPageFlow(int page)
          handle forms drawing as not take care of in decodePage as in other modes
 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).
static void setBorderStyle(int style)
           
 void setCenterOnScaling(boolean center)
           
static void setDebugPrint(boolean newDebugPrint)
          provides details on printing to enable debugging info for IDRsolutions
static void setDefaultDisplayFont(java.lang.String fontName)
          set the font used for default from Java fonts on system - Java fonts are case sensitive, but JPedal resolves this internally, so you could use Webdings, webdings or webDings for Java font Webdings - checks if it is a valid Java font (otherwise it will default to Lucida anyway)
 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 setDownloadWindomPosition(int x, int y)
           
 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.
static java.lang.String setFontDirs(java.lang.String[] fontDirs)
          takes a String[] of font directories and adds to substitution - Can just be called for each JVM - Should be called before file opened - this offers an alternative to the call -DFontDirs - Passing a null value flushes all settings
static void setFontReplacements(PdfDecoder decode_pdf)
          set up our font replacement values
static void setFontSubstitutionMode(int mode)
          set mode to use when substituting fonts (default is to use Filename (ie arial.ttf) Options are SUBSTITUTE_* values from PdfDecoder
 void setlastPageDecoded(int page)
          set page number for last page decoded (only use in SingleDisplay mode) Only used when file is not PDf but has multiple pages (i.e multipaged tiff)
 void setMouseMode(int mouseMode)
           
 void setMultiPageTiff(boolean isMultiPageTiff)
           
 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 setPDF(boolean isPDf)
           
 void setPrintAutoRotateAndCenter(boolean value)
          set print mode (Matches Abodes Auto Print and rotate output
 void setPrintCurrentView(boolean value)
           
 void setPrintIndent(int oddPages, int evenPages)
          set a left margin for printing pages (ie for duplex) (ent only)
 void setPrintPageMode(int mode)
          allow user to select only odd or even pages to print
 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 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.
static void setSubstitutedFontAliases(java.lang.String fontFileName, java.lang.String[] aliases)
          allows a number of fonts to be mapped onto an actual font and provides a way around slightly differing font naming when substituting fonts - So if arialMT existed on the target machine and the PDF contained arial and helvetica (which you wished to replace with arialmt), you would use the following code -

String[] aliases={"arial","helvetica"}; currentPdfDecoder.setSubstitutedFontAliases("arialmt",aliases); -

comparison is case-insensitive and file type/ending should not be included - For use in conjunction with -Dorg.jpedal.fontdirs options which allows user to pass a set of comma separated directories with Truetype fonts (directories do not need to exist so can be multi-platform setting)

 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 setThumbnailsDrawing(boolean b)
          initialise display hotspots and save global values public void createPageHostspots(String[] annotationTypes, String string) { if(showAnnotations) return; if(displayHotspots==null || specialMode==SpecialOptions.NONE || specialMode==SpecialOptions.SINGLE_PAGE) displayHotspots = new Hotspots(annotationTypes, string); printHotspots = new Hotspots(annotationTypes, string); }/
 void setupPage(org.jpedal.parser.PdfStreamDecoder current, boolean alwaysCheck)
          initialise OC Content and other items before Page decoded but after Resources read
 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 showImageableArea()
          show the imageable area in printout for debugging purposes
 void stopPrinting()
          ask JPedal to stop printing a page
 void unsetScaling()
           
 void updatePageNumberDisplayed(int page)
          used by Javascript to update page number
 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 org.jpedal.PdfPanel
addHighlights, addToLineAreas, clearHighlights, disableBorderForPrinting, ensurePointIsVisible, getCombinedAreas, getCurrentPageCoords, getCursorBoxOnScreen, getDisplayView, getHighlightAreas, getHighlightedAreas, getHighlightImage, getInsetH, getInsetW, getLineAreas, getLineWritingMode, getMaximumSize, getMinimumSize, getPageAsThumbnail, getPageFlowBar, getPDFHeight, getPDFWidth, getPreferredSize, getPrintPageScalingMode, getRawPDFHeight, getRawPDFWidth, getScaling, getScrollInterval, getUserOffsets, initNonPDF, isExtractingAsImage, isImageExtractionAllowed, paint, paintComponent, removeFoundTextArea, removeFoundTextAreas, removeHiglightedObject, repaintArea, scrollRectToHighlight, setDrawCrossHairs, setDrawInteractively, setExtractingAsImage, setFoundParagraph, setHardwareAccelerationforScreen, setHighlightAreas, setHighlightedImage, setHighlightedZones, setImageExtractionAllowed, setInset, setLineAreas, setLineWritingMode, setMessageFrame, setPageRotation, setPDFBorder, setPrintPageScalingMode, setScrollInterval, setUsePDFPaperSize, setUserOffsets, updateCursorBoxOnScreen
 
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, 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, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, 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

java3DAvailable

public static boolean java3DAvailable

usePageFlow3D

public static boolean usePageFlow3D

version

public static final java.lang.String version
See Also:
Constant Field Values

debugHiRes

public static boolean debugHiRes

optimiseType3Rendering

public static final boolean optimiseType3Rendering
See Also:
Constant Field Values

Helper

public static JPedalHelper Helper

MOUSE_MODE_TEXT_SELECT

public static final int MOUSE_MODE_TEXT_SELECT
See Also:
Constant Field Values

MOUSE_MODE_PANNING

public static final int MOUSE_MODE_PANNING
See Also:
Constant Field Values

currentHeightLookupData

public static org.jpedal.fonts.PdfHeightTable currentHeightLookupData
lookup table to precalculated height values


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

clipOnMac

public static boolean clipOnMac

debugPrint

public static boolean debugPrint
provide print debug feature - used for internal development only


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


inDemo

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

See Also:
Constant Field Values

hires

public static boolean hires
custom hi-res val for JPedal settings


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 colr 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

enforceFontSubstitution

public static boolean enforceFontSubstitution
flag to show if there must be a mapping value (program exits if none found)


defaultFont

public static java.lang.String defaultFont
font to use in preference to Lucida


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

BORDER_SHOW

public static final int BORDER_SHOW
See Also:
Constant Field Values

BORDER_HIDE

public static final int BORDER_HIDE
See Also:
Constant Field Values

CURRENT_BORDER_STYLE

public static int CURRENT_BORDER_STYLE

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

getMouseMode

public int getMouseMode()

setMouseMode

public void setMouseMode(int mouseMode)

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

setBorderStyle

public static void setBorderStyle(int style)

getBorderStyle

public static int getBorderStyle()

setPrintIndent

public void setPrintIndent(int oddPages,
                           int evenPages)
set a left margin for printing pages (ie for duplex) (ent only)

Parameters:
oddPages -

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 -

addAdditionalPage

public void addAdditionalPage(org.jpedal.render.DynamicVectorRenderer dynamicRenderer,
                              int pageWidth,
                              int origPageWidth)
used by Storypad to display split spreads not aprt of API


getXDisplacement

public int getXDisplacement()

getAdditionalPageCount

public int getAdditionalPageCount()

updatePageNumberDisplayed

public void updatePageNumberDisplayed(int page)
used by Javascript to update page number


getlastPageDecoded

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


setlastPageDecoded

public void setlastPageDecoded(int page)
set page number for last page decoded (only use in SingleDisplay mode) Only used when file is not PDf but has multiple pages (i.e multipaged tiff)


setupPage

public void setupPage(org.jpedal.parser.PdfStreamDecoder current,
                      boolean alwaysCheck)
initialise OC Content and other items before Page decoded but after Resources read

Parameters:
current -

isHires

public static boolean isHires()

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


resetFormsForPageFlow

public void resetFormsForPageFlow(int page)
handle forms drawing as not take care of in decodePage as in other modes


getOutlineData

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

Returns:
OutlineData

setSubstitutedFontAliases

public static void setSubstitutedFontAliases(java.lang.String fontFileName,
                                             java.lang.String[] aliases)
allows a number of fonts to be mapped onto an actual font and provides a way around slightly differing font naming when substituting fonts - So if arialMT existed on the target machine and the PDF contained arial and helvetica (which you wished to replace with arialmt), you would use the following code -

String[] aliases={"arial","helvetica"}; currentPdfDecoder.setSubstitutedFontAliases("arialmt",aliases); -

comparison is case-insensitive and file type/ending should not be included - For use in conjunction with -Dorg.jpedal.fontdirs options which allows user to pass a set of comma separated directories with Truetype fonts (directories do not need to exist so can be multi-platform setting)


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

setFontDirs

public static java.lang.String setFontDirs(java.lang.String[] fontDirs)
takes a String[] of font directories and adds to substitution - Can just be called for each JVM - Should be called before file opened - this offers an alternative to the call -DFontDirs - Passing a null value flushes all settings

Returns:
String which will be null or list of directories it could not find

setFontSubstitutionMode

public static void setFontSubstitutionMode(int mode)
set mode to use when substituting fonts (default is to use Filename (ie arial.ttf) Options are SUBSTITUTE_* values from PdfDecoder


getFontSubstitutionMode

public static int getFontSubstitutionMode()
set mode to use when substituting fonts (default is to use Filename (ie arial.ttf) Options are SUBSTITUTE_* values from PdfDecoder


addFontFile

public static void addFontFile(java.lang.String currentFont,
                               java.lang.String fontPath)
method to add a single file to the PDF renderer

Parameters:
currentFont - - actual font name we use to identify
fontPath - - full path to font file used for this font

getPageAlignment

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


init

public static final 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

dispose

public final void dispose()
convenience method to remove all items from memory


closePdfFile

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


getPdfBuffer

public final byte[] getPdfBuffer()
convenience method to get the PDF data as a byte array - works however file was opened.

Returns:
byte array containing 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

getPageOffsets

public java.awt.Point getPageOffsets(int page)

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

setPrintPageMode

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


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

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)


setCenterOnScaling

public void setCenterOnScaling(boolean center)

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 pf,
                 int page)
          throws java.awt.print.PrinterException
implements the standard Java printing functionality if start
Specified by:
print in interface java.awt.print.Printable
Parameters:
graphics - - object page rendered onto
pf - PageFormat object used to print
page - - current page index (less 1 so start at page 0)
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)
                              throws java.lang.Exception
put page onto G2

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 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


stopPrinting

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


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

decodeOtherPages

public final void decodeOtherPages(int pageCount)
used to decode multiple pages on views


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

Throws:
java.lang.Exception

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


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


getPDFflag

public int getPDFflag(java.lang.Integer i)
give user access to PDF flag value - if file not open or input not valid returns -1

Possible values in PdfFLAGS

ie PDFflags.USER_ACCESS_PERMISSIONS - return P value

PDFflags.VALID_PASSWORD_SUPPLIED - tell if password supplied and if owner or user POssible values PDFflags.NO_VALID_PASSWORD, PDFflags.VALID_USER_PASSWORD, PDFflags.VALID_OWNER_PASSWORD or both USER and owner


setDefaultDisplayFont

public static final void setDefaultDisplayFont(java.lang.String fontName)
                                        throws PdfFontException
set the font used for default from Java fonts on system - Java fonts are case sensitive, but JPedal resolves this internally, so you could use Webdings, webdings or webDings for Java font Webdings - checks if it is a valid Java font (otherwise it will default to Lucida anyway)

Throws:
PdfFontException

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 cntaining 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 under 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 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

setDownloadWindomPosition

public void setDownloadWindomPosition(int x,
                                      int y)

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() to Java will not release all the memory If boolean supportLinearized is true, method will return with true value once Linearized part read

Throws:
PdfException

isPDFLinearized

public final boolean isPDFLinearized(java.lang.String pdfUrl)
                              throws PdfException
examine first few bytes to see if linearized and return true linearized file

Parameters:
pdfUrl -
Returns:
Throws:
PdfException

getLayers

public PdfLayerList getLayers()
Deprecated. - please use (PdfLayerList)getJPedalObject(PdfDictionary.Layer);

will return Layout dictionary when code enabled (resolved at this point)


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)

addSubstituteFonts

public boolean addSubstituteFonts(java.lang.String fontPath,
                                  boolean enforceMapping)
This routine allows the user to add truetype, type1 or type1C fonts which will be used to disalay the fonts in PDF rendering and substitution as if the fonts were embedded in the PDF
This is very useful for clients looking to keep down the size of PDFs transmitted and control display quality -

Thanks to Peter for the idea/code -

How to set it up -

JPedal will look for the existence of the directory fontPath (ie com/myCompany/Fonts) -

If this exists, Jpedal will look for 3 possible directories (tt,t1c,t1) and make a note of any fonts if these directories exist -

When fonts are resolved, this option will be tested first and if a font if found, it will be used to display the font (the effect will be the same as if the font was embedded) -

If the enforceMapping is true, JPedal assumes there must be a match and will throw a PdfFontException -

Otherwise Jpedal will look in the java font path for a match or approximate with Lucida -

The Format is defined as follows: -

fontname = filename

Type1/Type1C Font names exclude any prefix so /OEGPNB+FGHeavyItalic is resolved to FGHeavyItalic -

Each font have the same name as the font it replaces (so Arial will require a font file such as Arial.ttf) and it must be unique (there cannot be an Arial font in each sub-directory) -

So to use this functionality, place the fonts in a jar or add to the JPedal jar and call this method after instancing PdfDecoder - JPedal will do the rest

Parameters:
fontPath - - root directory for fonts
enforceMapping - - tell JPedal if all fonts should be in this directory
Returns:
flag (true if fonts added)

setThumbnailsDrawing

public void setThumbnailsDrawing(boolean b)
initialise display hotspots and save global values public void createPageHostspots(String[] annotationTypes, String string) { if(showAnnotations) return; if(displayHotspots==null || specialMode==SpecialOptions.NONE || specialMode==SpecialOptions.SINGLE_PAGE) displayHotspots = new Hotspots(annotationTypes, string); printHotspots = new Hotspots(annotationTypes, string); }/


showImageableArea

public void showImageableArea()
show the imageable area in printout for debugging purposes


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)

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)

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.


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.


addImage

public void addImage(java.awt.image.BufferedImage img)
used to display non-PDF files


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

getFontsInFile

public java.lang.String getFontsInFile()
Returns list of the fonts used on the current page decoded


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 or being decoded. 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 - 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


setDebugPrint

public static void setDebugPrint(boolean newDebugPrint)
provides details on printing to enable debugging info for IDRsolutions


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


getCurrentPrintPage

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


resetCurrentPrintPage

public void resetCurrentPrintPage()

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 -

getYCordForPage

public int getYCordForPage(int page,
                           float scaling)
used internally by multiple pages scaling -1 to ignore, -2 to force reset


unsetScaling

public void unsetScaling()

getXCordForPage

public int getXCordForPage(int page,
                           float scaling)
used internally by multiple pages scaling -1 to ignore, -2 to force reset


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()
return swing widget regardless of whether it came from Annot or form


isThumbnailsDrawing

public boolean isThumbnailsDrawing()

setPageCount

public void setPageCount(int numPages)

isPDF

public boolean isPDF()

setPDF

public void setPDF(boolean isPDf)

isMultiPageTiff

public boolean isMultiPageTiff()

setMultiPageTiff

public void setMultiPageTiff(boolean isMultiPageTiff)

getFileName

public java.lang.String getFileName()

getObjectUnderneath

public int getObjectUnderneath(int x,
                               int y)

setFontReplacements

public static void setFontReplacements(PdfDecoder decode_pdf)
set up our font replacement values

Parameters:
decode_pdf -

getJPedalActionHandlers

public java.util.Map getJPedalActionHandlers()

isForm

public boolean isForm()

JPedal Java PDF library 4.01b28 API Documentation - http://www.jpedal.org

JPedal Java PDF library 4.01b28 API Documentation - http://www.jpedal.org