Package com.ribs.pdf
Class PDFPageParser
java.lang.Object
com.ribs.pdf.PDFPageParser
This 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 SummaryConstructorsConstructorDescriptionPDFPageParser(PDFFile aPdfFile, int aPageIndex) Creates a new page parser for a given PDF file and a page index.
- 
Method SummaryModifier and TypeMethodDescriptionvoidEstablishes an image transform and tells markup engine to draw the imagevoidestablishClip(GeneralPath newclip, boolean intersect) Called when the clipping path changes.voidvoidstatic intgetPDFHexString(byte[] pageBytes, int start, int end, com.ribs.pdf.Range r) replace ascii hex in pageBytes with actual bytes.static byte[]intThe lexer.voidparse()Main entry point Runs the lexer on the pdf content and passes the list of tokens to the parser.voidThe 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 Details- 
PDFPageParserCreates a new page parser for a given PDF file and a page index.
 
- 
- 
Method Details- 
getTokensThe lexer. Fills the tokens list from the page contents. Returns the index of the character after the last succesfully consumed character.
- 
getPDFHexString
- 
getPDFHexStringpublic static int getPDFHexString(byte[] pageBytes, int start, int end, com.ribs.pdf.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.
- 
parseThe 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.
- 
executeForm
- 
executePatternStream
- 
parseTextOperator
- 
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.
- 
drawImageEstablishes an image transform and tells markup engine to draw the image
- 
establishClipCalled 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. 
 
-