public final class

NewPage

extends Object
java.lang.Object
   ↳ com.pspdfkit.document.processor.NewPage

Class Overview

Settings for new page to be added to a PDF. Instances of this class are immutable and can be generated using the NewPage.Builder.

Summary

Nested Classes
class NewPage.Builder Builder for NewPage objects. 
interface NewPage.OnDrawCanvasCallback Callback passed to fromCanvas(Size, OnDrawCanvasCallback) to perform the drawing on the document canvas. 
Fields
public static final Size PAGE_SIZE_A0 Standard A0 841x1189mm size.
public static final Size PAGE_SIZE_A4 Standard A4 210x297mm size.
public static final Size PAGE_SIZE_A5 Standard A5 148x210mm size.
public static final Size PAGE_SIZE_B4 Standard B4 250x353mm size.
public static final Size PAGE_SIZE_B5 Standard B5 176x250mm size.
public static final Size PAGE_SIZE_US_LEGAL Standard US letter 8.5x11" size.
public static final Size PAGE_SIZE_US_LETTER Standard US legal 8.5x14" size.
public final int backgroundColor
public final EdgeInsets margins
public final Size pageSize
public final int rotation
public final InternalPdfDocument sourceDocument
Public Methods
static NewPage.Builder emptyPage(Size pageSize)
Creates a new empty page.
static NewPage.Builder fromCanvas(Size pageSize, NewPage.OnDrawCanvasCallback callback)
Creates a new page from a Canvas holding all the draw calls.
static NewPage.Builder fromPage(PdfDocument sourceDocument, int pageIndex)
Copies page from a source document.
boolean hasPatternSource()
Used to determine whether new page was created using pattern.
boolean hasPdfPageSource()
Used to determine whether new page was created using PDF document as its source.
static NewPage.Builder patternPage(Size pageSize, PagePattern pattern)
Creates a new page with a preset pattern.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static final Size PAGE_SIZE_A0

Standard A0 841x1189mm size.

public static final Size PAGE_SIZE_A4

Standard A4 210x297mm size.

public static final Size PAGE_SIZE_A5

Standard A5 148x210mm size.

public static final Size PAGE_SIZE_B4

Standard B4 250x353mm size.

public static final Size PAGE_SIZE_B5

Standard B5 176x250mm size.

public static final Size PAGE_SIZE_US_LEGAL

Standard US letter 8.5x11" size.

public static final Size PAGE_SIZE_US_LETTER

Standard US legal 8.5x14" size.

public final int backgroundColor

public final EdgeInsets margins

public final Size pageSize

public final int rotation

public final InternalPdfDocument sourceDocument

Public Methods

public static NewPage.Builder emptyPage (Size pageSize)

Creates a new empty page.

Parameters
pageSize Page size in PDF points.

public static NewPage.Builder fromCanvas (Size pageSize, NewPage.OnDrawCanvasCallback callback)

Creates a new page from a Canvas holding all the draw calls.

Parameters
pageSize Page size in PDF points.
callback An NewPage.OnDrawCanvasCallback that should be called to perform the drawing on the canvas.

public static NewPage.Builder fromPage (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.

public 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 and false otherwise.

public 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) and false otherwise.

public static NewPage.Builder patternPage (Size pageSize, PagePattern pattern)

Creates a new page with a preset pattern.

Parameters
pageSize Page size in PDF points.
pattern Pattern on the page.

public String toString ()