-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class PdfPage implements Closeable
Represents a single page in a PdfDocument.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPdfPage.Companion
-
Constructor Summary
Constructors Constructor Description PdfPage(PdfDocument doc, Integer pageIndex, Long pagePtr, Map<Integer, PdfDocument.PageCount> pageMap)
-
Method Summary
Modifier and Type Method Description final PdfDocumentgetDoc()final IntegergetPageIndex()final LonggetPagePtr()final PdfTextPageopenTextPage()Open a text page final IntegergetPageWidth(Integer screenDpi)Get page width in pixels. final IntegergetPageHeight(Integer screenDpi)Get page height in pixels. final IntegergetPageWidthPoint()Get page width in PostScript points (1/72th of an inch). final IntegergetPageHeightPoint()Get page height in PostScript points (1/72th of an inch) final RectFgetPageCropBox()Get the page's crop box in PostScript points (1/72th of an inch) final RectFgetPageMediaBox()Get the page's media box in PostScript points (1/72th of an inch) final RectFgetPageBleedBox()Get the page's bleed box in PostScript points (1/72th of an inch) final RectFgetPageTrimBox()Get the page's trim box in PostScript points (1/72th of an inch) final RectFgetPageArtBox()Get the page's art box in PostScript points (1/72th of an inch) final RectFgetPageBoundingBox()Get the page's bounding box in PostScript points (1/72th of an inch) final SizegetPageSize(Integer screenDpi)Get the page's size in pixels final UnitrenderPage(Surface surface, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)Render page fragment on Surface. final UnitrenderPageBitmap(Bitmap bitmap, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot, Boolean textMask)Render page fragment on Bitmap. final UnitrenderPageBitmap(Bitmap bitmap, Matrix matrix, RectF clipRect, Boolean renderAnnot, Boolean textMask)final List<PdfDocument.Link>getPageLinks()Get all links from given page final PointmapPageCoordsToDevice(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)Map page coordinates to device screen coordinates final PointFmapDeviceCoordsToPage(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)Map device screen coordinates to page coordinates final RectmapRectToDevice(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, RectF coords)maps a rectangle from page space to device space final RectFmapRectToPage(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Rect coords)Maps a rectangle from device space to page space Unitclose()Close the page and release all resources -
-
Constructor Detail
-
PdfPage
PdfPage(PdfDocument doc, Integer pageIndex, Long pagePtr, Map<Integer, PdfDocument.PageCount> pageMap)
-
-
Method Detail
-
getDoc
final PdfDocument getDoc()
-
getPageIndex
final Integer getPageIndex()
-
getPagePtr
final Long getPagePtr()
-
openTextPage
final PdfTextPage openTextPage()
Open a text page
-
getPageWidth
final Integer getPageWidth(Integer screenDpi)
Get page width in pixels.
- Parameters:
screenDpi- screen DPI (Dots Per Inch)
-
getPageHeight
final Integer getPageHeight(Integer screenDpi)
Get page height in pixels.
- Parameters:
screenDpi- screen DPI (Dots Per Inch)
-
getPageWidthPoint
final Integer getPageWidthPoint()
Get page width in PostScript points (1/72th of an inch).
-
getPageHeightPoint
final Integer getPageHeightPoint()
Get page height in PostScript points (1/72th of an inch)
-
getPageCropBox
final RectF getPageCropBox()
Get the page's crop box in PostScript points (1/72th of an inch)
-
getPageMediaBox
final RectF getPageMediaBox()
Get the page's media box in PostScript points (1/72th of an inch)
-
getPageBleedBox
final RectF getPageBleedBox()
Get the page's bleed box in PostScript points (1/72th of an inch)
-
getPageTrimBox
final RectF getPageTrimBox()
Get the page's trim box in PostScript points (1/72th of an inch)
-
getPageArtBox
final RectF getPageArtBox()
Get the page's art box in PostScript points (1/72th of an inch)
-
getPageBoundingBox
final RectF getPageBoundingBox()
Get the page's bounding box in PostScript points (1/72th of an inch)
-
getPageSize
final Size getPageSize(Integer screenDpi)
Get the page's size in pixels
-
renderPage
final Unit renderPage(Surface surface, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)
Render page fragment on Surface.<br></br>
- Parameters:
surface- Surface on which to render pagestartX- left position of the page in the surfacestartY- top position of the page in the surfacedrawSizeX- horizontal size of the page on the surfacedrawSizeY- vertical size of the page on the surfacerenderAnnot- whether render annotation
-
renderPageBitmap
final Unit renderPageBitmap(Bitmap bitmap, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot, Boolean textMask)
Render page fragment on Bitmap.<br></br>
- Parameters:
bitmap- Bitmap on which to render pagestartX- left position of the page in the bitmapstartY- top position of the page in the bitmapdrawSizeX- horizontal size of the page on the bitmapdrawSizeY- vertical size of the page on the bitmaprenderAnnot- whether render annotationtextMask- whether to render text as image mask
-
renderPageBitmap
final Unit renderPageBitmap(Bitmap bitmap, Matrix matrix, RectF clipRect, Boolean renderAnnot, Boolean textMask)
-
getPageLinks
final List<PdfDocument.Link> getPageLinks()
Get all links from given page
-
mapPageCoordsToDevice
final Point mapPageCoordsToDevice(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)
Map page coordinates to device screen coordinates
- Parameters:
startX- left pixel position of the display area in device coordinatesstartY- top pixel position of the display area in device coordinatessizeX- horizontal size (in pixels) for displaying the pagesizeY- vertical size (in pixels) for displaying the pagerotate- page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)pageX- X value in page coordinatespageY- Y value in page coordinate
-
mapDeviceCoordsToPage
final PointF mapDeviceCoordsToPage(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)
Map device screen coordinates to page coordinates
- Parameters:
startX- left pixel position of the display area in device coordinatesstartY- top pixel position of the display area in device coordinatessizeX- horizontal size (in pixels) for displaying the pagesizeY- vertical size (in pixels) for displaying the pagerotate- page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)deviceX- X value in page coordinatesdeviceY- Y value in page coordinate
-
mapRectToDevice
final Rect mapRectToDevice(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, RectF coords)
maps a rectangle from page space to device space
- Parameters:
startX- left pixel position of the display area in device coordinatesstartY- top pixel position of the display area in device coordinatessizeX- horizontal size (in pixels) for displaying the pagesizeY- vertical size (in pixels) for displaying the pagerotate- page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)coords- rectangle to map
-
mapRectToPage
final RectF mapRectToPage(Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Rect coords)
Maps a rectangle from device space to page space
- Parameters:
startX- left pixel position of the display area in device coordinatesstartY- top pixel position of the display area in device coordinatessizeX- horizontal size (in pixels) for displaying the pagesizeY- vertical size (in pixels) for displaying the pagerotate- page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)coords- rectangle to map
-
-
-
-