-
public final class PdfFileManages PDF document and its pages.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPdfFile.Companion
-
Field Summary
Fields Modifier and Type Field Description private IntegerpagesCountprivate final SizeFmaxPageSizeprivate final FloatmaxPageWidthprivate final FloatmaxPageHeight
-
Method Summary
Modifier and Type Method Description final IntegergetPagesCount()final UnitsetPagesCount(Integer pagesCount)final SizeFgetMaxPageSize()final FloatgetMaxPageWidth()final FloatgetMaxPageHeight()final UnitrecalculatePageSizes(Size viewSize)Recalculates the page sizes, offsets, and document length based on the current view size. final SizeFgetPageSize(Integer pageIndex)final SizeFgetScaledPageSize(Integer pageIndex, Float zoom)final FloatgetDocLen(Float zoom)final FloatgetPageLength(Integer pageIndex, Float zoom)Get the page's height if swiping vertical, or width if swiping horizontal. final FloatgetPageSpacing(Integer pageIndex, Float zoom)final FloatgetPageOffset(Integer pageIndex, Float zoom)Get primary page offset, that is Y for vertical scroll and X for horizontal scroll final FloatgetSecondaryPageOffset(Integer pageIndex, Float zoom)Get secondary page offset, that is X for vertical scroll and Y for horizontal scroll final IntegergetPageAtOffset(Float offset, Float zoom)final BooleanopenPage(Integer pageIndex)final BooleanpageHasError(Integer pageIndex)final UnitrenderPageBitmap(Bitmap bitmap, Integer pageIndex, Rect bounds, Boolean annotationRendering)final MetagetMetaData()final List<Bookmark>getBookmarks()final List<Link>getPageLinks(Integer pageIndex)final RectFmapRectToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, RectF rect)final Unitdispose()final IntegerdetermineValidPageNumberFrom(Integer userPage)Ensures the given user-specified page number is within the valid range, considering the original user-defined page order if provided. final IntegerdocumentPage(Integer userPage)-
-
Constructor Detail
-
PdfFile
PdfFile(PdfiumCore pdfiumCore, FitPolicy pageFitPolicy, Size viewSize, List<Integer> originalUserPages, Boolean isVertical, Integer spacingPx, Boolean autoSpacing, Boolean fitEachPage, Integer maxPageCacheSize, Boolean singlePageMode)
- Parameters:
pdfiumCore- The {@link PdfiumCore} instance used to interact with the PDF document.pageFitPolicy- The policy used to fit pages to the view.viewSize- The size of the view where the PDF document is displayed.originalUserPages- The original user-defined page order (optional).isVertical- True if scrolling is vertical, else it's horizontal.spacingPx- Fixed spacing between pages in pixels.autoSpacing- Calculate spacing automatically so each page fits on its own in the center of the view.fitEachPage- True if every page should fit separately according to the {@link FitPolicy}, else the largest page fits and other pages scale relatively.maxPageCacheSize- The maximum number of pages that can be kept in the viewsinglePageMode- When true, positions each page individually for single-page-at-a-time viewing
-
-
Method Detail
-
getPagesCount
final Integer getPagesCount()
-
setPagesCount
final Unit setPagesCount(Integer pagesCount)
-
getMaxPageSize
final SizeF getMaxPageSize()
-
getMaxPageWidth
final Float getMaxPageWidth()
-
getMaxPageHeight
final Float getMaxPageHeight()
-
recalculatePageSizes
final Unit recalculatePageSizes(Size viewSize)
Recalculates the page sizes, offsets, and document length based on the current view size.
- Parameters:
viewSize- The size of the view where the PDF document is displayed.
-
getPageSize
final SizeF getPageSize(Integer pageIndex)
-
getScaledPageSize
final SizeF getScaledPageSize(Integer pageIndex, Float zoom)
-
getPageLength
final Float getPageLength(Integer pageIndex, Float zoom)
Get the page's height if swiping vertical, or width if swiping horizontal.
-
getPageSpacing
final Float getPageSpacing(Integer pageIndex, Float zoom)
-
getPageOffset
final Float getPageOffset(Integer pageIndex, Float zoom)
Get primary page offset, that is Y for vertical scroll and X for horizontal scroll
-
getSecondaryPageOffset
final Float getSecondaryPageOffset(Integer pageIndex, Float zoom)
Get secondary page offset, that is X for vertical scroll and Y for horizontal scroll
-
getPageAtOffset
final Integer getPageAtOffset(Float offset, Float zoom)
-
pageHasError
final Boolean pageHasError(Integer pageIndex)
-
renderPageBitmap
final Unit renderPageBitmap(Bitmap bitmap, Integer pageIndex, Rect bounds, Boolean annotationRendering)
-
getMetaData
final Meta getMetaData()
-
getBookmarks
final List<Bookmark> getBookmarks()
-
getPageLinks
final List<Link> getPageLinks(Integer pageIndex)
-
mapRectToDevice
final RectF mapRectToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, RectF rect)
-
determineValidPageNumberFrom
final Integer determineValidPageNumberFrom(Integer userPage)
Ensures the given user-specified page number is within the valid range, considering the original user-defined page order if provided.
- Parameters:
userPage- The user-specified page number.
-
documentPage
final Integer documentPage(Integer userPage)
-
-
-
-