Class NewPage
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
NewPage.OnDrawCanvasCallback
Callback passed to fromCanvas to perform the drawing on the document canvas.
public class
NewPage.Builder
Builder for NewPage objects.
-
Field Summary
Fields Modifier and Type Field Description public final static Size
PAGE_SIZE_A0
public final static Size
PAGE_SIZE_A4
public final static Size
PAGE_SIZE_A5
public final static Size
PAGE_SIZE_US_LEGAL
public final static Size
PAGE_SIZE_US_LETTER
public final static Size
PAGE_SIZE_B4
public final static Size
PAGE_SIZE_B5
public final Size
pageSize
public final EdgeInsets
margins
public final int
rotation
public final int
backgroundColor
public final InternalPdfDocument
sourceDocument
-
Method Summary
Modifier and Type Method Description static NewPage.Builder
emptyPage(@NonNull() Size pageSize)
Creates a new empty page. static NewPage.Builder
fromPage(@NonNull() PdfDocument sourceDocument, int pageIndex)
Copies page from a source document. static NewPage.Builder
patternPage(@NonNull() Size pageSize, @NonNull() PagePattern pattern)
Creates a new page with a preset pattern. static NewPage.Builder
fromCanvas(@NonNull() Size pageSize, @NonNull() NewPage.OnDrawCanvasCallback callback)
Creates a new page from a Canvas holding all the draw calls. NativeNewPageConfiguration
getNativeNewPageConfiguration()
Returns native NewPageConfiguration object. boolean
hasPdfPageSource()
Used to determine whether new page was created using PDF document as its source. boolean
hasPatternSource()
Used to determine whether new page was created using pattern. String
toString()
-
-
Method Detail
-
emptyPage
@NonNull() static NewPage.Builder emptyPage(@NonNull() Size pageSize)
Creates a new empty page.
- Parameters:
pageSize
- Page size in PDF points.
-
fromPage
@NonNull() static NewPage.Builder fromPage(@NonNull() PdfDocument sourceDocument, int pageIndex)
Copies page from a source document.
- Parameters:
sourceDocument
- Document to copy page from.pageIndex
- Index of page in the source document.
-
patternPage
@NonNull() static NewPage.Builder patternPage(@NonNull() Size pageSize, @NonNull() PagePattern pattern)
Creates a new page with a preset pattern.
- Parameters:
pageSize
- Page size in PDF points.pattern
- Pattern on the page.
-
fromCanvas
@NonNull() static NewPage.Builder fromCanvas(@NonNull() Size pageSize, @NonNull() NewPage.OnDrawCanvasCallback callback)
Creates a new page from a Canvas holding all the draw calls.
- Parameters:
pageSize
- Page size in PDF points.callback
- An OnDrawCanvasCallback that should be called to perform the drawing on the canvas.
-
getNativeNewPageConfiguration
@NonNull() NativeNewPageConfiguration getNativeNewPageConfiguration()
Returns native NewPageConfiguration object. Note that it runs image loading and conversion so it shouldn't be called on the main thread.
-
hasPdfPageSource
boolean hasPdfPageSource()
Used to determine whether new page was created using PDF document as its source. Keep in mind that having both PDF document and pattern as a source of a new page isn't possible.
- Returns:
true
if page was created using PDF document source (this will be the case when using page templates) andfalse
otherwise.
-
hasPatternSource
boolean hasPatternSource()
Used to determine whether new page was created using pattern. Keep in mind that having both PDF document and pattern as a source of a new page isn't possible.
- Returns:
true
if page was created using pattern source andfalse
otherwise.
-
-
-
-