Class PDFPageParser
- java.lang.Object
- 
- com.inductiveautomation.rm.pdf.reader.PDFPageParser
 
- 
 public class PDFPageParser extends java.lang.ObjectThis class parses the page marking operators for a specific page number (it gets the contents for that page from n RMPDFParser.) It uses the various factory objects for graphic object creation and a MarkupHandler to do the actual drawing.Currently unsupported: - Ignores hyperlinks (annotations) - Type 1 & Type 3 fonts - Transparency blend modes other than /Normal ... 
- 
- 
Constructor SummaryConstructors Constructor Description PDFPageParser(PDFFile aPdfFile, int aPageIndex)Creates a new page parser for a given PDF file and a page index.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrawImage(java.awt.Image im)Establishes an image transform and tells markup engine to draw the imagevoidestablishClip(java.awt.geom.GeneralPath newclip, boolean intersect)Called when the clipping path changes.voidexecuteForm(PDFForm f)voidexecutePatternStream(TilingPattern pat)static intgetPDFHexString(byte[] pageBytes, int start, int end, com.inductiveautomation.rm.pdf.reader.Range r)Replace ascii hex in pageBytes with actual bytes.static byte[]getPDFHexString(java.lang.String s)intgetTokens(byte[] pageBytes, int offset, int end, java.util.List tokens)The lexer.voidparse()Main entry point.voidparse(java.util.List tokenList, byte[] pageBytes)The meat and potatoes of the pdf parser.intparseInlineImage(int tIndex, byte[] pageBytes)Converts the tokens & data inside a BI/EI block into an image and draws it.booleanparseTextOperator(byte oper, int tindex, int numops, PDFGState gs, byte[] pageBytes)
 
- 
- 
- 
Constructor Detail- 
PDFPageParserpublic PDFPageParser(PDFFile aPdfFile, int aPageIndex) Creates a new page parser for a given PDF file and a page index.
 
- 
 - 
Method Detail- 
getTokenspublic int getTokens(byte[] pageBytes, int offset, int end, java.util.List tokens)The lexer. Fills the tokens list from the page contents. Returns the index of the character after the last successfully consumed character.
 - 
getPDFHexStringpublic static byte[] getPDFHexString(java.lang.String s) 
 - 
getPDFHexStringpublic static int getPDFHexString(byte[] pageBytes, int start, int end, com.inductiveautomation.rm.pdf.reader.Range r)Replace ascii hex in pageBytes with actual bytes. Start points to first char after the '<', end is the upper limit to seek through. r gets filled with the actual ranbge of the converted bytes return value is index of last character swallowed. See comment for getPDFString... about destructive behavior.
 - 
parsepublic void parse() Main entry point. Runs the lexer on the pdf content and passes the list of tokens to the parser. By separating out a routine that operates on the list of tokens, we can implement Forms & patterns by recursively calling the parse routine with a subset of the token list.
 - 
parsepublic void parse(java.util.List tokenList, byte[] pageBytes)The meat and potatoes of the pdf parser. Translates the token list into a series of calls to either a Factory class, which creates a Java2D object (like GeneralPath, Font, Image, GlyphVector, etc.), or the markup handler, which does the actual drawing.
 - 
executeFormpublic void executeForm(PDFForm f) 
 - 
executePatternStreampublic void executePatternStream(TilingPattern pat) 
 - 
parseTextOperatorpublic boolean parseTextOperator(byte oper, int tindex, int numops, PDFGState gs, byte[] pageBytes)
 - 
parseInlineImagepublic int parseInlineImage(int tIndex, byte[] pageBytes)Converts the tokens & data inside a BI/EI block into an image and draws it. Returns the index of the last token consumed.
 - 
drawImagepublic void drawImage(java.awt.Image im) Establishes an image transform and tells markup engine to draw the image
 - 
establishClippublic void establishClip(java.awt.geom.GeneralPath newclip, boolean intersect)Called when the clipping path changes. The clip in the gstate is defined to be in page space. Whenever the clip is changed, we calculate the new clip, which can be intersected with the old clip, and save it in the gstate.NB. This routine modifies the path that's passed in to it. 
 
- 
 
-