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
 
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 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 boolean extAtBestQuality
           
static int FINALIMAGES
          flag to show extraction mode includes final scaled/clipped
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 isRunningOnLinux
           
static boolean isRunningOnMac
          flag to show if on mac so we can code around certain bugs
static boolean isRunningOnWindows
           
static float multiplyer
          custom upscale val for JPedal settings
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 int samplingUsed
           
static boolean showErrorMessages
          flag to enable popup of error messages in JPedal
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) - this is the default off setting
static boolean use13jPEGConversion
          flag to say if java 1.3 version should be used for JPEG conversion (new JPEG bugs in Suns 1.4 code)
static boolean useFullSizeImage
           
static java.lang.String version
           
static int XFORMMETADATA
          flag to show extraction of xforms metadata
 
Fields inherited from class org.jpedal.PdfPanel
backgroundColor, extraButton, highlightColor, SHOW_BOXES, SHOW_LINES, SHOW_OBJECTS, showAnnotations, useParentButtons
 
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()
PdfDecoder(int mode, boolean newRender)
          Not part of API - internal IDR method subject to frequent change
 
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 addUserIconsForAnnotations(int page, java.lang.String type, java.awt.Image[] icons)
          allow user to set own icons for annotation hotspots to display in renderer - pass user selection of hotspots as an array of format Image[number][page] where number is Annot number on page and page is current page -1 (ie 0 is page 1).
 void clearScreen()
          remove all displayed objects for JPanel display (wipes current page)
 void closePdfFile()
          convenience method to close the current PDF file
 void createPageHostspots(java.lang.String[] annotationTypes, java.lang.String string)
          initialise display hotspots and save global values
 void decodeOtherPages(int pageCount)
          used to decode multiple pages on views
 void decodePage(int page)
          decode a page, - page must be between 1 and PdfDecoder.getPageCount() - Will kill off if already running
 PdfAnnots decodePageForAnnotations(int i)
          just extract annotations for a page - if you want to decode the page and extract the annotations use decodePage(int pageNumber) which does both.
 void decodePageForMarkedContent(java.lang.String ref, 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).
 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 flushAdditionalPages()
          used by Storypad to display split spreads not part of API
 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
 int getBorderStyle()
           
 int getCurrentPrintPage()
          return page currently being printed or -1 if finished
 org.jpedal.render.DynamicVectorRenderer getDynamicRenderer()
          gets DynamicVector Object - NOT PART OF API and subject to change (DO NOT USE)
 org.jpedal.render.DynamicVectorRenderer getDynamicRenderer(boolean reset)
          gets DynamicVector Object - NOT PART OF API and subject to change (DO NOT 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.Integer getFormComponentType(java.lang.String name)
          return swing widget regardless of whether it came from Annot or form -1 if not found values in FormFactory (ie UNKNOWN)
 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.
 org.jpedal.io.PdfObjectReader getIO()
          return swing widget regardless of whether it came from Annot or form
 org.jpedal.objects.Javascript getJavascript()
          allow access to Javascript object.
 int getlastPageDecoded()
          return page number for last page decoded (only use in SingleDisplay mode)
 org.jpedal.objects.layers.PdfLayerList getLayers()
          will return Layout dictionary when code enabled (resolved at this point)
 org.w3c.dom.Document getMarkedContent()
          return markedContent object as XML Document
 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
 int getPageAlignment()
          return type of alignment for pages if smaller than panel - see options in Display class.
 java.awt.image.BufferedImage getPageAsImage(int pageIndex)
          generate BufferedImage of a page in current file
 java.awt.image.BufferedImage getPageAsThumbnail(int pageNumber, int h)
          Deprecated.  
 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
 org.jpedal.objects.PageLines getPageLines()
          return lines on page after decodePage run - not part of API, please do not use
 PdfAnnots getPdfAnnotsData(org.jpedal.objects.acroforms.rendering.AcroRenderer formRenderer)
          provide method for outside class to get Annots data object
Please note: Structure of PdfPageData is not guaranteed to remain constant
Please contact IDRsolutions for advice (pass in null object if using externally)
 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.
 PdfPageData getPdfBackgroundPageData()
          Deprecated. from 2.50
 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

 PdfFormData getPdfFormData()
          provide method for outside class to get data object containing all form data - Returns null in demo version
 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.
 java.util.Map getUserIconsForAnnotations()
          return Map with user-defined annotation icons for display
 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
 void includeImagesInStream()
          include image data in PdfData - not part of API, please do not use
 void init(boolean newEmbedWidthData)
          This will be needed for text extraction as it paramter makes sure widths included in text stream
 boolean isDecoding()
          ask JPedal if stopDecoding() request completed
 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()
          flag which is set to true if current PDF is a form
 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 isThumbnailsDrawing()
           
 boolean isXFAForm()
          show if page is an XFA form
static boolean isXMLExtraction()
          shows if text extraction is XML or pure text
 void markAllPagesAsUnread()
          Deprecated.  
static void modifyJPedalParameters(java.util.Map values)
          allow user to alter certain values in software such as Colour,
 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.
 void openPdfFileFromURL(java.lang.String pdfUrl)
          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

 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 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).
 java.util.Map resolveFormReference(java.lang.String ref)
          convert form ref into actual object
 java.util.Map resolveToMapOrString(java.lang.String string, java.lang.Object rawAnnotDetails)
          returns object, handling any indirect references
 void setAlternativeOutlines(java.awt.Rectangle[] outlines, java.lang.String altName)
           
 void setBorderStyle(int style)
           
 void setCenterOnScaling(boolean center)
           
static void setDebugPrint(boolean newDebugPrint)
          provides details on printing to enable debugging info for IDRsolutions
 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 setEnableLegacyJPEGConversion(boolean newjPEGConversion)
          if true uses the original jpeg routines provided by sun, else uses the imageIO routine in java 14 which is default
only required for PDFs where bug in some versions of ImageIO fails to render JPEGs correctly
 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)
          Deprecated. Please do not use. Use setPageParameters(scalingValue, pageNumber) instead;
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 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 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 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 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.
 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)
           
 void setupPage(org.jpedal.parser.PdfStreamDecoder current)
          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 stopDecoding()
          ask JPedal to stop decoding a page - this is not part of api and not a recommend way to shutdown a thread
 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
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 waitForRenderingToFinish()
          wait for rendering to finiah
 
Methods inherited from class org.jpedal.PdfPanel
addHiglightedObject, addMergingDisplayForDebugging, disableBorderForPrinting, ensurePointIsVisible, getCombinedAreas, getDisplayView, getHighlightImage, getInsetH, getInsetW, getMaximumSize, getMinimumSize, getPageAsThumbnail, getPageHotspots, getParentChildButton, getParentChildButtonArray, getPDFHeight, getPDFWidth, getPreferredSize, getPrintPageScalingMode, getRawPDFHeight, getRawPDFWidth, getScaling, getScrollInterval, getToolTipText, initNonPDF, isImageExtractionAllowed, paint, paintComponent, removeFoundTextArea, removeFoundTextAreas, removeHiglightedObject, repaintArea, scrollRectToHighlight, setAnnotationsVisible, setDebugDisplay, setDebugView, setDrawCrossHairs, setDrawInteractively, setFoundTextArea, setFoundTextAreas, setHardwareAccelerationforScreen, setHighlightedAreas, setHighlightedImage, setHighlightedZones, setImageExtractionAllowed, setInset, setMessageFrame, setPageParameters, setPageParameters, setPageRotation, setParentChildButton, setParentChildButtonArray, setPDFBorder, setPrintPageScalingMode, setScrollInterval, setUsePDFPaperSize, 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, 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

version

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

optimiseType3Rendering

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

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

multiplyer

public static float multiplyer
custom upscale val for JPedal settings


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


use13jPEGConversion

public static boolean use13jPEGConversion
flag to say if java 1.3 version should be used for JPEG conversion (new JPEG bugs in Suns 1.4 code)


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

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

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) - this is the default off setting

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


useFullSizeImage

public static boolean useFullSizeImage

samplingUsed

public static int samplingUsed

extAtBestQuality

public static boolean extAtBestQuality
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(int mode,
                  boolean newRender)
Not part of API - internal IDR method subject to frequent change


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

setBorderStyle

public void setBorderStyle(int style)

getBorderStyle

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

setAlternativeOutlines

public void setAlternativeOutlines(java.awt.Rectangle[] outlines,
                                   java.lang.String altName)

flushAdditionalPages

public void flushAdditionalPages()
used by Storypad to display split spreads not part of API


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)
initialise OC Content and other items before Page decoded but after Resources read

Parameters:
current -

setSubstitutedFontAliases

public 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,
pdfHe