Multivalent API

multivalent.std.adaptor.pdf
Class PDF

java.lang.Object
  extended by multivalent.VObject
      extended by multivalent.Behavior
          extended by multivalent.MediaAdaptor
              extended by multivalent.std.adaptor.pdf.PDF

public class PDF
extends MediaAdaptor

Parse a page of PDF and display with Java 2's 2D API.

Document Tree Construction

The PDF content stream is translated into a Multivalent document tree as follows. The tree is live: reformat. Objects drawn as appear in content stream, which usually but not necessarily follows reading order, To see the document tree for any particular PDF page, turn on the Debug switch in the Help menu, then select Debug/View Document Tree.

See Also

Version:
$Revision: 1.156 $ $Date: 2005/05/01 03:32:32 $

Field Summary
static boolean GoFast
          Go fast or be exactly correct.
static java.lang.String MSG_DUMP
          Message of semantic event to control dumping of uncompress and decrypted content stream to temporary file.
static java.lang.String MSG_GO_FAST
          Message "pdfSetGoFast": faster rendering if sometimes less accurate: arg=boolean or null to toggle.
static java.lang.String MSG_OWNER_PASSWORD
          Message of semantic event to set the user password so encrypted files can be read, with the password String passed in arg.
static java.lang.String MSG_USER_PASSWORD
          Message of semantic event to set the owner password so encrypted files can be read, with the password String passed in arg.
static java.lang.String OCG_OFF
           
static java.lang.String OCG_ON
           
static java.lang.String VAR_OCG
          Optional content groups stored in Document under this key.
 
Fields inherited from class multivalent.MediaAdaptor
HINT_DEFAULTS, HINT_EXACT, HINT_FAST, HINT_METADATA_ONLY, HINT_NO_IMAGE, HINT_NO_INTERACTIVE, HINT_NO_LAYOUT, HINT_NO_SHAPE, HINT_NO_SHOW, HINT_NO_STYLE, HINT_NO_TEXT, HINT_NO_TRANSCLUSION, HINT_NONE, HINT_NORMALIZE
 
Fields inherited from class multivalent.Behavior
ATTR_BEHAVIOR, name_
 
Fields inherited from class multivalent.VObject
attr_
 
Constructor Summary
PDF()
           
 
Method Summary
 void close()
          Close media adaptor, freeing any resources.
 boolean formatAfter(Node node)
          Enlarge content root to MediaBox.
 java.awt.Rectangle getCropBox()
           
 java.util.Map<java.lang.String,java.lang.Object> getForm()
          Returns interactive from as Map with keys the fully qualified.
 java.awt.Rectangle getMediaBox()
           
 PDFReader getReader()
           
 java.awt.geom.AffineTransform getTransform()
           
 boolean isAuthorized()
           
 java.lang.Object parse(INode parent)
          Parses individual page indicated in Document.ATTR_PAGE of parent's containing Document and returns formatted document tree rooted at parent as described above.
 boolean semanticEventAfter(SemanticEvent se, java.lang.String msg)
          Implements MSG_DUMP, MSG_USER_PASSWORD, MSG_OWNER_PASSWORD.
 boolean semanticEventBefore(SemanticEvent se, java.lang.String msg)
          "Dump PDF to temp dir" in Debug menu.
 void setPassword(java.lang.String pw)
           
 void setReader(PDFReader pdfr)
           
 
Methods inherited from class multivalent.MediaAdaptor
buildBefore, destroy, getHints, getInputUni, getURI, getZoom, isStopped, parseHelper, setHints, setInput, setInput, setZoom, stop
 
Methods inherited from class multivalent.Behavior
buildAfter, checkRep, clipboardAfter, clipboardBefore, createUI, eventAfter, eventBefore, formatBefore, getBrowser, getDocument, getInstance, getInstance, getLayer, getLogger, getName, getPreference, getRoot, isEditable, paintAfter, paintBefore, putPreference, redo, restore, restoreChildren, save, setName, toString, undo
 
Methods inherited from class multivalent.VObject
attrEntrySetIterator, attrKeysIterator, clearAttributes, getAttr, getAttr, getAttributes, getGlobal, getValue, hasAttributes, putAttr, removeAttr, setAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MSG_GO_FAST

public static final java.lang.String MSG_GO_FAST
Message "pdfSetGoFast": faster rendering if sometimes less accurate: arg=boolean or null to toggle.

See Also:
Constant Field Values

MSG_OWNER_PASSWORD

public static final java.lang.String MSG_OWNER_PASSWORD
Message of semantic event to set the user password so encrypted files can be read, with the password String passed in arg.

See Also:
Constant Field Values

MSG_USER_PASSWORD

public static final java.lang.String MSG_USER_PASSWORD
Message of semantic event to set the owner password so encrypted files can be read, with the password String passed in arg.

See Also:
Constant Field Values

MSG_DUMP

public static final java.lang.String MSG_DUMP
Message of semantic event to control dumping of uncompress and decrypted content stream to temporary file.

See Also:
Constant Field Values

VAR_OCG

public static final java.lang.String VAR_OCG
Optional content groups stored in Document under this key. The value there is a Map with names of optional content groups as keys and OCG_ON and OCG_OFF as values.

See Also:
Constant Field Values

OCG_ON

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

OCG_OFF

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

GoFast

public static boolean GoFast
Go fast or be exactly correct.

Constructor Detail

PDF

public PDF()
Method Detail

setReader

public void setReader(PDFReader pdfr)
               throws java.io.IOException
Throws:
java.io.IOException

getReader

public PDFReader getReader()

isAuthorized

public boolean isAuthorized()
Overrides:
isAuthorized in class MediaAdaptor

setPassword

public void setPassword(java.lang.String pw)
Overrides:
setPassword in class MediaAdaptor

getMediaBox

public java.awt.Rectangle getMediaBox()

getCropBox

public java.awt.Rectangle getCropBox()

getTransform

public java.awt.geom.AffineTransform getTransform()

getForm

public java.util.Map<java.lang.String,java.lang.Object> getForm()
                                                         throws java.io.IOException
Returns interactive from as Map with keys the fully qualified. This Map represents the current settings of the form, as modified by the user or by PDF actions (reset, import) or programmatically.

Throws:
java.io.IOException

parse

public java.lang.Object parse(INode parent)
                       throws java.io.IOException,
                              ParseException
Parses individual page indicated in Document.ATTR_PAGE of parent's containing Document and returns formatted document tree rooted at parent as described above.

Specified by:
parse in class MediaAdaptor
Returns:
root of PDF subtree under parent
Throws:
java.io.IOException
ParseException
See Also:
for a convenient way to attach spans

formatAfter

public boolean formatAfter(Node node)
Enlarge content root to MediaBox.

Overrides:
formatAfter in class Behavior
Returns:
true to short-circuit formatting of rest of protocol, which consists exclusively of higher-priority behaviors, which almost never want to do.

semanticEventBefore

public boolean semanticEventBefore(SemanticEvent se,
                                   java.lang.String msg)
"Dump PDF to temp dir" in Debug menu.

Overrides:
semanticEventBefore in class Behavior

semanticEventAfter

public boolean semanticEventAfter(SemanticEvent se,
                                  java.lang.String msg)
Implements MSG_DUMP, MSG_USER_PASSWORD, MSG_OWNER_PASSWORD.

Overrides:
semanticEventAfter in class MediaAdaptor

close

public void close()
           throws java.io.IOException
Description copied from class: MediaAdaptor
Close media adaptor, freeing any resources.

Overrides:
close in class MediaAdaptor
Throws:
java.io.IOException

Multivalent API