com.spire.pdf
Class PdfPageBase

java.lang.Object
  extended by com.spire.pdf.PdfPageBase
All Implemented Interfaces:
IPdfWrapper
Direct Known Subclasses:
PdfNewPage, PdfPageWidget

public abstract class PdfPageBase
extends java.lang.Object
implements IPdfWrapper

The base class for all pages.


Constructor Summary
PdfPageBase(PdfDictionary dic)
           
PdfPageBase(PdfDictionary dic, PdfCrossTable crossTable)
           
 
Method Summary
 PdfTemplate createTemplate()
          Creates a template from page content and all annotation appearances.
 void deleteImage(int imageIndex)
           
 java.awt.image.BufferedImage[] extractImages()
          Extracts images from the given PDF Page.
 java.awt.image.BufferedImage[] extractImages(boolean processImage)
          Extracts images from the given PDF Page.
 java.lang.String extractText()
          Extracts text from the given PDF Page.
 java.lang.String extractText(boolean keepWhiteSpace)
          Extracts text from the given PDF Page.
 java.lang.String extractText(boolean keepWhiteSpace, boolean optimizingTextLine)
          Extracts text from the given PDF Page.
 java.lang.String extractText(boolean keepWhiteSpace, boolean optimizingTextLine, boolean optimizingGridText)
          Extracts text from the given PDF Page.
 java.lang.String extractText(java.awt.geom.Rectangle2D rectangele)
          Extracts text in the range of rectangle from the given PDF Page.
 java.lang.String extractText(java.awt.geom.Rectangle2D rectangle, SimpleTextExtractionStrategy sim)
           
 java.lang.String extractText(SimpleTextExtractionStrategy strategy)
          Extracts text from the given PDF Page by SimpleTextExtractionStrategy.
 PdfTextFindCollection findAllText()
          Find all text and position.
 PdfTextFindCollection findText(java.lang.String searchPatternText)
          find text
 PdfTextFindCollection findText(java.lang.String searchPatternText, boolean isSearchWholeWord)
          find text that intends to search and that Indicate the expected result is the whole word or not, which means, if it is true, only the word is exactly the same with the searching word will be found;if it is false, any word including the searching word will be found.
 PdfTextFindCollection findText(java.lang.String searchPatternText, boolean isSearchWholeWord, boolean ignoreCase)
          find text
 PdfTextFindCollection findText(java.lang.String searchPatternText, java.util.EnumSet<TextFindParameter> parameter)
          Find text
 java.awt.geom.Rectangle2D getActualBounds(boolean includeMargins)
          Calculates actual bounds of the page.
 java.awt.geom.Dimension2D getActualSize()
          Gets the actual size of the page.
 boolean getAllowContainTopDocTemplates()
          Gets the template that Allow Contain Top Doc Templates.
 PdfAnnotationCollection getAnnotationsWidget()
          Gets the field collection.
 java.awt.geom.Rectangle2D getArtBox()
          Returns page region containing content.
 float getBackgroudOpacity()
          Gets the transparency to draw the image
 java.awt.Color getBackgroundColor()
          Gets page's background color.
 java.awt.image.BufferedImage getBackgroundImage()
          Gets page's background image.
 java.awt.geom.Rectangle2D getBackgroundRegion()
          The position and size of the background
 java.awt.geom.Rectangle2D getBleedBox()
          Returns page region after clipping.
 PdfCanvas getCanvas()
          Gets the graphics of the .
 java.awt.geom.Dimension2D getClientSize()
          Returns a page size reduced by page margins and page template dimensions.
 java.awt.geom.Rectangle2D getCropBox()
          Returns the visible region of the page.
 int getDefaultLayerIndex()
          Gets index of the default layer.
 PdfImageInfo[] getImagesInfo()
          Gets the information about the extracted image.
 java.awt.geom.Rectangle2D getMediaBox()
          Returns page region mediabox.
 java.lang.String getPageLabel()
          Get the page label.
 PdfPageLayerCollection getPageLayers()
          Gets the collection of the page's layers.
 PdfPageRotateAngle getRotation()
           
 PdfSection getSection()
          Gets the parent section of the page.
 java.awt.geom.Rectangle2D getTrimBox()
          Returns page region after trimming.
 boolean isAutoAdjustContent()
           
 void isAutoAdjustContent(boolean autoAdjustContent)
          some document page content does no start with q and end with Q,so need adjust content.
 boolean isBlank()
          Returns page is blank flag for page's content.
 void releaseExtactImageInfo()
           
 void replaceImage(int imageIndex, PdfImage image)
          Replace the Image at index's Position.
 void setAllowContainTopDocTemplates(boolean value)
          Sets the template that Allow Contain Top Doc Templates.
 void setAnnotationsWidget(PdfAnnotationCollection value)
          Sets the field collection.
 void setBackgroudOpacity(float value)
          Sets the transparency to draw the image
 void setBackgroundColor(java.awt.Color value)
           
 void setBackgroundImage(java.awt.image.BufferedImage value)
          Sets page's background color.
 void setBackgroundImage(java.lang.String imageFileName)
           
 void setBackgroundRegion(java.awt.geom.Rectangle2D value)
           
 void setDefaultLayerIndex(int value)
          Sets index of the default layer.
 void setRotation(PdfPageRotateAngle rotateAngle)
          Sets the page rotation.
 void setTabOrder(TabOrder tabOrder)
          Set tab order.
 boolean tryCompressImage(int imgIndex)
          Try to compress images(except inline image).
 

Constructor Detail

PdfPageBase

public PdfPageBase(PdfDictionary dic,
                   PdfCrossTable crossTable)

PdfPageBase

public PdfPageBase(PdfDictionary dic)
Method Detail

isAutoAdjustContent

public void isAutoAdjustContent(boolean autoAdjustContent)
some document page content does no start with q and end with Q,so need adjust content.

Parameters:
autoAdjustContent -

isAutoAdjustContent

public boolean isAutoAdjustContent()

isBlank

public boolean isBlank()
Returns page is blank flag for page's content.


getCropBox

public java.awt.geom.Rectangle2D getCropBox()
Returns the visible region of the page.


getBleedBox

public java.awt.geom.Rectangle2D getBleedBox()
Returns page region after clipping.


getAllowContainTopDocTemplates

public boolean getAllowContainTopDocTemplates()
Gets the template that Allow Contain Top Doc Templates.


setAllowContainTopDocTemplates

public void setAllowContainTopDocTemplates(boolean value)
Sets the template that Allow Contain Top Doc Templates.


getMediaBox

public java.awt.geom.Rectangle2D getMediaBox()
Returns page region mediabox.


getTrimBox

public java.awt.geom.Rectangle2D getTrimBox()
Returns page region after trimming.


getArtBox

public java.awt.geom.Rectangle2D getArtBox()
Returns page region containing content.


getAnnotationsWidget

public PdfAnnotationCollection getAnnotationsWidget()
Gets the field collection.


setAnnotationsWidget

public void setAnnotationsWidget(PdfAnnotationCollection value)
Sets the field collection.


getImagesInfo

public PdfImageInfo[] getImagesInfo()
Gets the information about the extracted image.

Throws:
com.spire.ms.System.Exception

getCanvas

public PdfCanvas getCanvas()
Gets the graphics of the .


getSection

public PdfSection getSection()
Gets the parent section of the page.


getPageLayers

public PdfPageLayerCollection getPageLayers()
Gets the collection of the page's layers.


getDefaultLayerIndex

public int getDefaultLayerIndex()
Gets index of the default layer.


setDefaultLayerIndex

public void setDefaultLayerIndex(int value)
Sets index of the default layer.


getActualSize

public java.awt.geom.Dimension2D getActualSize()
Gets the actual size of the page.


getRotation

public PdfPageRotateAngle getRotation()

setRotation

public void setRotation(PdfPageRotateAngle rotateAngle)
Sets the page rotation.

Parameters:
rotateAngle -

getBackgroundImage

public java.awt.image.BufferedImage getBackgroundImage()
Gets page's background image.


setBackgroundImage

public void setBackgroundImage(java.awt.image.BufferedImage value)
Sets page's background color.


setBackgroundImage

public void setBackgroundImage(java.lang.String imageFileName)

getBackgroundColor

public java.awt.Color getBackgroundColor()
Gets page's background color.


setBackgroundColor

public void setBackgroundColor(java.awt.Color value)

getBackgroudOpacity

public float getBackgroudOpacity()
Gets the transparency to draw the image


setBackgroudOpacity

public void setBackgroudOpacity(float value)
Sets the transparency to draw the image


getBackgroundRegion

public java.awt.geom.Rectangle2D getBackgroundRegion()
The position and size of the background


setBackgroundRegion

public void setBackgroundRegion(java.awt.geom.Rectangle2D value)

getPageLabel

public java.lang.String getPageLabel()
Get the page label.

Returns:
Throws:
com.spire.ms.System.Exception

getClientSize

public java.awt.geom.Dimension2D getClientSize()
Returns a page size reduced by page margins and page template dimensions.

Returns:
Returns a page size reduced by page margins and page template dimensions.
See Also:
It's the actual size of the page where some output can be performed.

getActualBounds

public java.awt.geom.Rectangle2D getActualBounds(boolean includeMargins)
Calculates actual bounds of the page.

Parameters:
includeMargins - If true - take into consideration Margins.
Returns:
Actual bounds of the page

replaceImage

public void replaceImage(int imageIndex,
                         PdfImage image)
Replace the Image at index's Position.

Parameters:
imageIndex - index of an image
image - The New Replace image

createTemplate

public PdfTemplate createTemplate()
Creates a template from page content and all annotation appearances.

Returns:
The created template.

findText

public PdfTextFindCollection findText(java.lang.String searchPatternText,
                                      boolean isSearchWholeWord)
find text that intends to search and that Indicate the expected result is the whole word or not, which means, if it is true, only the word is exactly the same with the searching word will be found;if it is false, any word including the searching word will be found. For instance,the text is "is this a pen?" and the target is "is", if true, one result will be returned; if false, two results will be returned.

Parameters:
searchPatternText -
isSearchWholeWord -
Returns:
PdfTextFindCollection
Throws:
com.spire.ms.System.Exception

findText

public PdfTextFindCollection findText(java.lang.String searchPatternText)
find text

Parameters:
searchPatternText - string searchPatternText
Returns:
PdfTextFindCollection

findText

public PdfTextFindCollection findText(java.lang.String searchPatternText,
                                      boolean isSearchWholeWord,
                                      boolean ignoreCase)
find text

Parameters:
searchPatternText -
isSearchWholeWord -
ignoreCase -
Returns:
PdfTextFindCollection
Throws:
com.spire.ms.System.Exception

findText

public PdfTextFindCollection findText(java.lang.String searchPatternText,
                                      java.util.EnumSet<TextFindParameter> parameter)
Find text

Parameters:
searchPatternText - The text intends to search.
parameter - contains four elements: None, IgnoreCase, WholeWord, and CrossLine. Four elements can be combined at will. such as: TextFindParameter.CrossLine | TextFindParameter.WholeWord | TextFindParameter.IgnoreCase.
Returns:

findAllText

public PdfTextFindCollection findAllText()
Find all text and position.

Returns:
PdfTextFindCollection
Throws:
com.spire.ms.System.Exception

extractText

public java.lang.String extractText()
Extracts text from the given PDF Page.

Returns:
The Extracted Text.

extractText

public java.lang.String extractText(SimpleTextExtractionStrategy strategy)
Extracts text from the given PDF Page by SimpleTextExtractionStrategy.

Parameters:
strategy -
Returns:
extracted text

extractText

public java.lang.String extractText(java.awt.geom.Rectangle2D rectangele)
Extracts text in the range of rectangle from the given PDF Page. The unit is Point,1/72 inch default. the coordinate origin is top left corner of the page.

Parameters:
rectangele -
Returns:
extracted text
Throws:
com.spire.ms.System.Exception

extractText

public java.lang.String extractText(java.awt.geom.Rectangle2D rectangle,
                                    SimpleTextExtractionStrategy sim)

extractText

public java.lang.String extractText(boolean keepWhiteSpace)
Extracts text from the given PDF Page.

Parameters:
keepWhiteSpace - A bool value indicate weather keep original white spaces.In addition, pictures in original pdf will be treated as white spaces. If keep white space ,the layout will be more similar to original pdf document.
Returns:
The Extracted Text.

extractText

public java.lang.String extractText(boolean keepWhiteSpace,
                                    boolean optimizingTextLine)
Extracts text from the given PDF Page.

Parameters:
keepWhiteSpace - A bool value indicate weather keep original white spaces.In addition, pictures in original pdf will be treated as white spaces. If keep white space ,the layout will be more similar to original pdf document.
optimizingTextLine - if a line sandwiched between two adjacent lines,try merging.default false.
Returns:
The Extracted Text.

extractText

public java.lang.String extractText(boolean keepWhiteSpace,
                                    boolean optimizingTextLine,
                                    boolean optimizingGridText)
Extracts text from the given PDF Page.

Parameters:
keepWhiteSpace - A bool value indicate weather keep original white spaces.In addition, pictures in original pdf will be treated as white spaces. If keep white space ,the layout will be more similar to original pdf document.
optimizingTextLine - if a line sandwiched between two adjacent lines,try merging.default false.
optimizingGridText - Customized client function.In Grid area, content text top align and remove middle blank line. each area split by blank line. default false.
Returns:
The Extracted Text.

extractImages

public java.awt.image.BufferedImage[] extractImages()
Extracts images from the given PDF Page.

Returns:
Returns the extracted image as Image[].

releaseExtactImageInfo

public void releaseExtactImageInfo()

extractImages

public java.awt.image.BufferedImage[] extractImages(boolean processImage)
Extracts images from the given PDF Page. and image is not processed.

Returns:
Returns the extracted image as Image[].

deleteImage

public void deleteImage(int imageIndex)

tryCompressImage

public boolean tryCompressImage(int imgIndex)
Try to compress images(except inline image).

Parameters:
imgIndex - The image index
Throws:
com.spire.ms.System.Exception

setTabOrder

public void setTabOrder(TabOrder tabOrder)
Set tab order.

Parameters:
tabOrder - The order name