public final class PdfPageEditor extends SaveableFacade
Represents a class to edit the PDF file's page, including rotating page, zooming page, moving position and changing page size.
Modifier and Type | Field and Description |
---|---|
static int |
BLINDH
Vertical Blinds
|
static int |
BLINDV
Vertical Blinds
|
static int |
BTWIPE
Bottom-Top Wipe
|
static int |
DGLITTER
Diagonal Glitter
|
static int |
DISSOLVE
Dissolve
|
static int |
INBOX
Inward Box
|
static int |
LRGLITTER
Left-Right Glitter
|
static int |
LRWIPE
Left-Right Wipe
|
static int |
OUTBOX
Outward Box
|
static int |
RLWIPE
Right-Left Wipe
|
static int |
SPLITHIN
IN Horizontal Split
|
static int |
SPLITHOUT
Out Horizontal Split
|
static int |
SPLITVIN
In Vertical Split
|
static int |
SPLITVOUT
Out Vertical Split
|
static int |
TBGLITTER
Top-Bottom Glitter
|
static int |
TBWIPE
Top-Bottom Wipe
|
Constructor and Description |
---|
PdfPageEditor()
|
PdfPageEditor(Document document)
|
Modifier and Type | Method and Description |
---|---|
void |
applyChanges()
Apply changes made to the document pages.
|
AlignmentType |
getAlignment()
Deprecated.
|
int |
getDisplayDuration()
Gets display duration for pages.
|
int |
getHorizontalAlignment()
Gets the horizontal alignment of the original PDF content on the result page, default is AlignmentType.Left.
|
android.graphics.Rect |
getPageBoxSize(int page,
String pageBoxName)
Returns size of specified box in document.
|
int |
getPageRotation(int page)
Returns the rotation of specified page.
|
Map |
getPageRotations()
Gets the rotation of the pages,
A hashtable contains the page number and rotation degree,
the key represents the page number, the value of key represents the rotation in degrees.
|
int[] |
getPages_Rename_Namesake()
Gets the page numbers to be edited.
|
int |
getPages()
Returns total number of pages.
|
PageSize |
getPageSize()
Gets the output file's page size.
|
PageSize |
getPageSize(int page)
Returns the page size of the specified page.
|
int |
getRotation()
Gets the rotation of the pages, the rotation must be 0, 90, 180 or 270.
|
int |
getTransitionDuration()
Gets duration of the transition effect.
|
int |
getTransitionType()
Gets transition style to use when moving to this page from another during a presentation.
|
VerticalAlignmentType |
getVerticalAlignment()
Deprecated.
|
int |
getVerticalAlignmentType()
Gets or Sets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
|
float |
getZoom()
Get zoom coefficient.
|
void |
movePosition(float moveX,
float moveY)
Moves the origin from (0, 0) to the point that appointted.
|
void |
save(OutputStream outputStream)
Saves changed document into stream.
|
void |
save(String outputFile)
Saves changed document into file.
|
void |
setAlignment(AlignmentType value)
Deprecated.
|
void |
setDisplayDuration(int value)
Sets display duration for pages.
|
void |
setHorizontalAlignment(int value)
Sets the horizontal alignment of the original PDF content on the result page, default is AlignmentType.Left.
|
void |
setPageRotations(Map value)
Sets the rotation of the pages,
A hashtable contains the page number and rotation degree,
the key represents the page number, the value of key represents the rotation in degrees.
|
void |
setPages(int[] value)
Sets the page numbers to be edited.
|
void |
setPageSize(PageSize value)
Sets the output file's page size.
|
void |
setRotation(int value)
Sets the rotation of the pages, the rotation must be 0, 90, 180 or 270.
|
void |
setTransitionDuration(int value)
Sets duration of the transition effect.
|
void |
setTransitionType(int value)
Sets transition style to use when moving to this page from another during a presentation.
|
void |
setVerticalAlignment(VerticalAlignmentType value)
Deprecated.
|
void |
setVerticalAlignmentType(int value)
Sets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
|
void |
setZoom(float value)
Sets zoom coefficient.
|
save
public static final int SPLITVOUT
Out Vertical Split
public static final int SPLITHOUT
Out Horizontal Split
public static final int SPLITVIN
In Vertical Split
public static final int SPLITHIN
IN Horizontal Split
public static final int BLINDV
Vertical Blinds
public static final int BLINDH
Vertical Blinds
public static final int INBOX
Inward Box
public static final int OUTBOX
Outward Box
public static final int LRWIPE
Left-Right Wipe
public static final int RLWIPE
Right-Left Wipe
public static final int BTWIPE
Bottom-Top Wipe
public static final int TBWIPE
Top-Bottom Wipe
public static final int DISSOLVE
Dissolve
public static final int LRGLITTER
Left-Right Glitter
public static final int TBGLITTER
Top-Bottom Glitter
public static final int DGLITTER
Diagonal Glitter
public PdfPageEditor()
public PdfPageEditor(Document document)
public int getTransitionDuration()
Gets duration of the transition effect.
public void setTransitionDuration(int value)
Sets duration of the transition effect.
public int getTransitionType()
Gets transition style to use when moving to this page from another during a presentation.
public void setTransitionType(int value)
Sets transition style to use when moving to this page from another during a presentation.
public int getDisplayDuration()
Gets display duration for pages.
public void setDisplayDuration(int value)
Sets display duration for pages.
public int[] getPages_Rename_Namesake()
Gets the page numbers to be edited. By default, each page would be edited.
public void setPages(int[] value)
Sets the page numbers to be edited. By default, each page would be edited.
public int getRotation()
Gets the rotation of the pages, the rotation must be 0, 90, 180 or 270. Default value is 0.
public void setRotation(int value)
Sets the rotation of the pages, the rotation must be 0, 90, 180 or 270. Default value is 0.
public Map getPageRotations()
Gets the rotation of the pages, A hashtable contains the page number and rotation degree, the key represents the page number, the value of key represents the rotation in degrees.
public void setPageRotations(Map value)
Sets the rotation of the pages, A hashtable contains the page number and rotation degree, the key represents the page number, the value of key represents the rotation in degrees.
public float getZoom()
Get zoom coefficient. Value 1.0 corresponds to 100%. Default value is 1.0.
public void setZoom(float value)
Sets zoom coefficient. Value 1.0 corresponds to 100%. Default value is 1.0.
The following example demonstrates how to change zoom of the document pages.PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); editor.setZoom ( 0.5f);
public PageSize getPageSize()
Gets the output file's page size.
public void setPageSize(PageSize value)
Sets the output file's page size.
@Deprecated public AlignmentType getAlignment()
Gets or sets the horizontal alignment of the original PDF content on the result page, default is AlignmentType.Left.
Use getHorizontalAlignment instead
@Deprecated public void setAlignment(AlignmentType value)
value
- public int getHorizontalAlignment()
Gets the horizontal alignment of the original PDF content on the result page, default is AlignmentType.Left.
public void setHorizontalAlignment(int value)
Sets the horizontal alignment of the original PDF content on the result page, default is AlignmentType.Left.
@Deprecated public VerticalAlignmentType getVerticalAlignment()
Gets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
Use getVerticalAlignmentType instead
@Deprecated public void setVerticalAlignment(VerticalAlignmentType value)
Sets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
Use setVerticalAlignmentType instead
public int getVerticalAlignmentType()
Gets or Sets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
public void setVerticalAlignmentType(int value)
Sets the vertical alignment of the original PDF content on the result page, default is VerticalAlignmentType.Bottom.
public void movePosition(float moveX, float moveY)
Moves the origin from (0, 0) to the point that appointted. The origin is left-bottom and the unit is point(1 inch = 72 points).
PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("input.pdf"); editor.movePosition(-100, 60); editor.save("moved.pdf");
moveX
- X-coordinate.moveY
- Y-coordinate.public int getPages()
Returns total number of pages.
The following example demonstrates using of GetPages() method:PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); System.out.println("Document has: " + editor.GetPages());
public PageSize getPageSize(int page)
Returns the page size of the specified page.
The following example demonstrates using of GetPageSize method:PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); PageSize size = editor.getPageSize(1); System.out.println("Size of 1st page : " + size.Width + " x " + size.Height);
page
- Page index. Document pages are numbered from 1.public int getPageRotation(int page)
Returns the rotation of specified page.
The following example demonstrates how to get page rotation:PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); int rotation = editor.GetPageSize(1); System.out.println("Rotation of 1st page : " + rotation + " degrees");
page
- Page index. Document pages are numbered from 1.public android.graphics.Rect getPageBoxSize(int page, String pageBoxName)
Returns size of specified box in document.
The following example demonstrates how to get media box of the 1st page:PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); Rectangle rect = editor.getBoxSize(1, "media");
page
- Page index. Document pages are numbered from 1.pageBoxName
- Box type name. Valid values are: "art", "bleed", "crop", "media", "trim".public void save(String outputFile)
Saves changed document into file.
The following sample demonstrates how to save changed PDF documentPdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); editor.setZoom ( 0.5f); editor.save("newdocument.pdf");
save
in interface ISaveableFacade
save
in class SaveableFacade
outputFile
- Path to file where document will be saved.public void save(OutputStream outputStream)
Saves changed document into stream.
The following sample demonstrates how to save changed PDF document into stream.PdfPageEditor editor = new PdfPageEditor(); editor.bindPdf("sample.pdf"); editor.setZoom ( 0.5f); editor.save("newdocument.pdf");
save
in interface ISaveableFacade
save
in class SaveableFacade
outputStream
- Stream where changed PDF document will be saved.public void applyChanges()
Apply changes made to the document pages.
Copyright © 2018 Aspose. All Rights Reserved.