public final class Page extends Object
Class representing page of PDF document.
Modifier and Type | Class and Description |
---|---|
static class |
Page.BeforePageGenerate
Procedure for customize header and footer.
|
Modifier and Type | Field and Description |
---|---|
com.aspose.pdf.engine.commondata.IPage |
EnginePage |
com.aspose.ms.lang.Event<Page.BeforePageGenerate> |
OnBeforePageGenerate |
Constructor and Description |
---|
Page(com.aspose.pdf.engine.commondata.IPage page) |
Modifier and Type | Method and Description |
---|---|
void |
accept(AnnotationSelector visitor)
Accepts
AnnotationSelector visitor object that provides functionality to work with annotations. |
void |
accept(ImagePlacementAbsorber visitor)
Accepts
ImagePlacementAbsorber visitor object that provides functionality to work with image placement objects. |
void |
accept(TextAbsorber visitor)
Accepts
TextAbsorber visitor object that provides functionality to work with text objects. |
void |
accept(TextFragmentAbsorber visitor)
Accepts
TextFragmentAbsorber visitor object that provides functionality to work with text objects. |
void |
addImage(InputStream imageStream,
Rectangle imageRect)
Adds image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addImage(InputStream imageStream,
Rectangle imageRect,
int imageWidth,
int imageHeight,
boolean saveImageProportions) |
void |
addImage(com.aspose.ms.System.IO.Stream stream,
Rectangle rectangle,
CompositingParameters compositingParameters)
Adds image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addImage(String hocr,
InputStream imageStream,
Rectangle imageRect)
Adds searchable image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addImage(String imagePath,
Rectangle rectangle)
Adds image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addImageInternal(com.aspose.ms.System.IO.Stream imageStream,
Rectangle imageRect)
Adds image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addImageInternal(String hocr,
com.aspose.ms.System.IO.Stream imageStream,
Rectangle imageRect)
Adds searchable image onto the page and locates it in the middle of specified rectangle saving image's proportion.
|
void |
addStamp(Stamp stamp)
Put stamp into page.
|
void |
clearContents() |
static com.aspose.ms.System.Collections.IList |
findReferences(OperatorCollection contents,
String name)
Returns list of operators which uses resource with specified name.
|
com.aspose.ms.System.Collections.IList |
findReferences(String name) |
void |
flatten()
Removes all fields located on the page and place their values instead.
|
void |
freeMemory()
Clears cached data
|
PageActionCollection |
getActions()
Gets collection of page properties.
|
AnnotationCollection |
getAnnotations()
Gets collection of page annotations.
|
Rectangle |
getArtBox()
Gets art box of the page.
|
ArtifactCollection |
getArtifacts()
Gets collection of artifacts on the page.
|
Color |
getBackground()
Gets the background color of the page.
|
Rectangle |
getBleedBox()
Gets bleed box of the page.
|
int |
getColorType()
Sets color type of the pages based on information getting from operators SetColor and
images.
|
OperatorCollection |
getContents()
Gets collection of operators in the content stream of the page.
|
ContentsAppender |
getContentsAppender()
Gets current contents appender.
|
Rectangle |
getCropBox()
Gets crop box of the page.
|
IDocument |
getDocument() |
double |
getDuration()
Gets of set page display duration.
|
HeaderFooter |
getFooter()
The page header.
|
Group |
getGroup()
Gets a group attributes class specifying the attributes of the page�s page group for use in the transparent imaging model.
|
HeaderFooter |
getHeader()
The page header.
|
Rectangle |
getMediaBox()
Gets media box of the page.
|
int |
getNumber()
Get number of the page.
|
PageInfo |
getPageInfo()
Gets the page info.
|
Rectangle |
getPageRect(boolean considerRotation)
Returns rectangle of the page.
|
Paragraphs |
getParagraphs()
Gets the paragraphs.
|
Rectangle |
getRect_Rename_Namesake()
Gets or sets rectangle of the page.
|
Rectangle |
getRect()
Gets or sets rectangle of the page.
|
Resources |
getResources()
Gets page resources.
|
int |
getRotate()
Gets rotation of the page.
|
Matrix |
getRotationMatrix()
Gets transfomation matrix for the page.
|
int |
getTabOrder()
Gets or sets tab order of the page.
|
TocInfo |
getTocInfo()
The table of contents info.
|
Rectangle |
getTrimBox()
Gets or sets trim box of the page.
|
Watermark |
getWatermark()
Gets the watermark of the page.
|
static int |
intToRotation(int rotation)
Translates integer value into corresponding rotation enumeration member.
|
void |
makeGrayscale()
Converts images on page as grayscaled.
|
static void |
removeObjectReferences(OperatorCollection contents,
String name) |
void |
removeObjectReferences(String name)
Remove references to XObject from page contents (i.e. all Do operators which use name of object).
|
static int |
rotationToInt(int rotation)
Translates rotation enumeration member into integer value.
|
void |
setArtBox(Rectangle value)
Sets art box of the page.
|
void |
setBackground(Color value)
Sets the background color of the page.
|
void |
setBleedBox(Rectangle value)
Sets bleed box of the page.
|
void |
setCropBox(Rectangle value)
Sets crop box of the page.
|
void |
setDuration(double value) |
void |
setFooter(HeaderFooter value) |
void |
setGroup(Group value)
Sets a group attributes class specifying the attributes of the page�s page group for use in the transparent imaging model.
|
void |
setHeader(HeaderFooter value) |
void |
setMediaBox(Rectangle value)
Sets media box of the page.
|
void |
setPageInfo(PageInfo value)
Sets the page info.
|
void |
setPageSize(double width,
double height)
Sets page size for page.
|
void |
setParagraphs(Paragraphs value) |
void |
setRect(Rectangle value) |
void |
setRotate(int value)
Sets rotation of the page.
|
void |
setTabOrder(int value) |
void |
setTocInfo(TocInfo value) |
void |
setTransition(com.aspose.pdf.engine.data.IPdfDictionary transition)
|
void |
setTrimBox(Rectangle value)
Sets trim box of the page.
|
void |
setWatermark(Watermark value)
Sets the watermark of the page.
|
public final com.aspose.ms.lang.Event<Page.BeforePageGenerate> OnBeforePageGenerate
public com.aspose.pdf.engine.commondata.IPage EnginePage
public TocInfo getTocInfo()
public void setTocInfo(TocInfo value)
public HeaderFooter getHeader()
public void setHeader(HeaderFooter value)
public HeaderFooter getFooter()
public void setFooter(HeaderFooter value)
public Paragraphs getParagraphs()
public void setParagraphs(Paragraphs value)
public PageInfo getPageInfo()
public void setPageInfo(PageInfo value)
value
- The page info.public IDocument getDocument()
public Rectangle getRect()
Gets or sets rectangle of the page. Page crop box is returned if specified, otherwise page media box is returned.
Example demonstrates how to get page rectangle:Document document = new Document("sample.pdf"); Page page = document.getPages().get(1); Rectangle pageRect = page.getRect();
public Rectangle getRect_Rename_Namesake()
Gets or sets rectangle of the page. Page crop box is returned if specified, otherwise page media box is returned. Please note that this property don't consider page rotation. To get page rectangle considering rotation please use ActualRect.
Example demonstrates how to get page rectangle:Document document = new Document("sample.pdf"); Page page = document.Pages[1]; Rectangle pageRect = page.Rect;
public void setRect(Rectangle value)
public int getColorType()
Sets color type of the pages based on information getting from operators SetColor and images.
public Rectangle getPageRect(boolean considerRotation)
Returns rectangle of the page.
considerRotation
- If true then rotation of the page will be considered in rect calculation.public int getTabOrder()
Gets or sets tab order of the page. Possible values: Row, Column. Default, Manual
public void setTabOrder(int value)
public double getDuration()
Gets of set page display duration. This is time in seconds that page shall be displayed during presentation. Returs -1 if duration is not defined.
Example demonstrates how to get page durationDocument document = new Document("sample.pdf"); Page page = document.getPages().get(1); int pageRect = page.Duration;
public void setDuration(double value)
public OperatorCollection getContents()
Gets collection of operators in the content stream of the page.
OperatorCollection
Example is demonstrates how to scan operators stream of page.Document document = new Document("sample.pdf"); Operators contents = document.Pages[1].Contents; for(Operator op : contents) { Ssytem.out.println(op); }
public Group getGroup()
Gets a group attributes class specifying the attributes of the page�s page group for use in the transparent imaging model.
public void setGroup(Group value)
Sets a group attributes class specifying the attributes of the page�s page group for use in the transparent imaging model.
public AnnotationCollection getAnnotations()
Gets collection of page annotations.
Annotations
public Resources getResources()
Gets page resources. Resources object contains collections of images, forms and fonts.
Resources
Example demonstrates scan through page images:Document document = new Document("sample.pdf"); DocumentActions actions = document.Actions; Resources resources = document.getPages().get(1).getResources(); for(XImage image : resources.getImages()) { System.out.println(image.Width + ":" + image.Height); }
public int getRotate()
Gets rotation of the page.
Example demonstrates how to determine page rotation.Document document = new Document("sample.pdf"); System.out.println(document.getPages().get(1).hryRotate());
public void setRotate(int value)
public Rectangle getTrimBox()
Gets or sets trim box of the page.
Example demonstrates how to get trim box of the page:Document document = new Document("sample.pdf"); Rectangle trimBox = document.getPages().get(1).getTrimBox();
public void setTrimBox(Rectangle value)
public Rectangle getArtBox()
Gets art box of the page.
Example demonstrates how to get art box of the page:Document document = new Document("sample.pdf"); Rectangle artBox = document.getPages().get(1).getArtBox();
public void setArtBox(Rectangle value)
public Rectangle getBleedBox()
Gets bleed box of the page.
Example demonstrates how to get bleed box of the page:Document document = new Document("sample.pdf"); Rectangle bleedBox = document.getPages().get(1).getBleedBox();
public void setBleedBox(Rectangle value)
public Rectangle getCropBox()
Gets crop box of the page.
Example demonstrates how to get crop box of the page:Document document = new Document("sample.pdf"); Rectangle cropBox = document.getPages().get(1).getCropBox();
public void setCropBox(Rectangle value)
public Rectangle getMediaBox()
Gets media box of the page.
Example demonstrates how to get media box of the page:Document document = new Document("sample.pdf"); Rectangle mediaBox = document.getPages().get(1).getMediaBox();
public void setMediaBox(Rectangle value)
public void accept(AnnotationSelector visitor)
Accepts AnnotationSelector
visitor object that provides functionality to work with annotations.
visitor
- public static int rotationToInt(int rotation)
Translates rotation enumeration member into integer value.
rotation
- Rotation enumeratioom member.public static int intToRotation(int rotation)
Translates integer value into corresponding rotation enumeration member.
rotation
- Integer value to convertpublic void addStamp(Stamp stamp)
Put stamp into page. Stamp can be page number, image or simple text, e.g. some logo.
stamp
- Stamp to add on the page.
Each stamp has its coordinates and corresponding properties regarding to the kind of stamp,
i.e. image or text value.public void addImageInternal(com.aspose.ms.System.IO.Stream imageStream, Rectangle imageRect)
imageStream
- The stream of the image.imageRect
- The position of the image.public void addImage(InputStream imageStream, Rectangle imageRect)
imageStream
- The stream of the image.imageRect
- The position of the image.public void addImageInternal(String hocr, com.aspose.ms.System.IO.Stream imageStream, Rectangle imageRect)
hocr
- The hocr of the image.imageStream
- The stream of the image.imageRect
- The position of the image.public void addImage(String hocr, InputStream imageStream, Rectangle imageRect)
hocr
- The hocr of the image.imageStream
- The stream of the image.imageRect
- The position of the image.public void addImage(InputStream imageStream, Rectangle imageRect, int imageWidth, int imageHeight, boolean saveImageProportions)
public void addImage(String imagePath, Rectangle rectangle)
imagePath
- The path to image.rectangle
- The position of the image.public void addImage(com.aspose.ms.System.IO.Stream stream, Rectangle rectangle, CompositingParameters compositingParameters)
stream
- The stream of the image.rectangle
- The position of the image.compositingParameters
- The compositing parameters.public void flatten()
Removes all fields located on the page and place their values instead.
public void accept(TextFragmentAbsorber visitor)
Accepts TextFragmentAbsorber
visitor object that provides functionality to work with text objects.
visitor
- public void accept(ImagePlacementAbsorber visitor)
Accepts ImagePlacementAbsorber
visitor object that provides functionality to work with image placement objects.
visitor
- public void accept(TextAbsorber visitor)
Accepts TextAbsorber
visitor object that provides functionality to work with text objects.
visitor
- public void setPageSize(double width, double height)
Sets page size for page.
width
- Page widthheight
- Page sizepublic void setTransition(com.aspose.pdf.engine.data.IPdfDictionary transition)
transition
- public int getNumber()
Get number of the page.
public Matrix getRotationMatrix()
Gets transfomation matrix for the page.
public ContentsAppender getContentsAppender()
Gets current contents appender.
ContentsAppender
public Color getBackground()
Gets the background color of the page.
public void setBackground(Color value)
Sets the background color of the page.
public Watermark getWatermark()
Gets the watermark of the page.
public void setWatermark(Watermark value)
Sets the watermark of the page.
public void removeObjectReferences(String name)
Remove references to XObject from page contents (i.e. all Do operators which use name of object).
name
- public static void removeObjectReferences(OperatorCollection contents, String name)
public com.aspose.ms.System.Collections.IList findReferences(String name)
public static com.aspose.ms.System.Collections.IList findReferences(OperatorCollection contents, String name)
Returns list of operators which uses resource with specified name.
name
- public void clearContents()
public ArtifactCollection getArtifacts()
Gets collection of artifacts on the page.
public PageActionCollection getActions()
Gets collection of page properties.
public void makeGrayscale()
Converts images on page as grayscaled.
public void freeMemory()
Clears cached data
Copyright © 2019 Aspose. All Rights Reserved.