-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public final class PdfDocument implements Closeable
PdfDocument represents a PDF file and allows you to load pages from it.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classPdfDocument.Metapublic final classPdfDocument.Bookmarkpublic final classPdfDocument.Linkpublic final classPdfDocument.PageCountpublic classPdfDocument.Companion
-
Field Summary
Fields Modifier and Type Field Description private BooleanisClosedprivate ParcelFileDescriptorparcelFileDescriptorprivate PdfiumSourcesourceprivate final LongmNativeDocPtr
-
Constructor Summary
Constructors Constructor Description PdfDocument(Long mNativeDocPtr)
-
Method Summary
Modifier and Type Method Description final BooleangetIsClosed()final UnitsetIsClosed(Boolean isClosed)final ParcelFileDescriptorgetParcelFileDescriptor()final UnitsetParcelFileDescriptor(ParcelFileDescriptor parcelFileDescriptor)final PdfiumSourcegetSource()final UnitsetSource(PdfiumSource source)final LonggetMNativeDocPtr()final IntegergetPageCount()Get the page count of the PDF document final IntArraygetPageCharCounts()Get the page character counts for every page of the PDF document final PdfPageopenPage(Integer pageIndex)Open page and store native pointer in PdfDocument final UnitdeletePage(Integer pageIndex)Delete page final List<PdfPage>openPages(Integer fromIndex, Integer toIndex)Open range of pages and store native pointers in PdfDocument final UnitrenderPages(Long bufferPtr, Integer drawSizeX, Integer drawSizeY, List<PdfPage> pages, List<Matrix> matrices, List<RectF> clipRects, Boolean renderAnnot, Boolean textMask, Integer canvasColor, Integer pageBackgroundColor)Render page fragment on Surface. final BooleanrenderPages(Surface surface, List<PdfPage> pages, List<Matrix> matrices, List<RectF> clipRects, Boolean renderAnnot, Boolean textMask, Integer canvasColor, Integer pageBackgroundColor)final PdfDocument.MetagetDocumentMeta()Get metadata for given document final List<PdfDocument.Bookmark>getTableOfContents()Get table of contents (bookmarks) for given document final PdfTextPageopenTextPage(PdfPage page)Open a text page final List<PdfTextPage>openTextPages(Integer fromIndex, Integer toIndex)Open a range of text pages final BooleansaveAsCopy(PdfWriteCallback callback, Integer flags)Save document as a copy Unitclose()Close the document -
-
Constructor Detail
-
PdfDocument
PdfDocument(Long mNativeDocPtr)
-
-
Method Detail
-
getIsClosed
final Boolean getIsClosed()
-
setIsClosed
final Unit setIsClosed(Boolean isClosed)
-
getParcelFileDescriptor
final ParcelFileDescriptor getParcelFileDescriptor()
-
setParcelFileDescriptor
final Unit setParcelFileDescriptor(ParcelFileDescriptor parcelFileDescriptor)
-
getSource
final PdfiumSource getSource()
-
setSource
final Unit setSource(PdfiumSource source)
-
getMNativeDocPtr
final Long getMNativeDocPtr()
-
getPageCount
final Integer getPageCount()
Get the page count of the PDF document
-
getPageCharCounts
final IntArray getPageCharCounts()
Get the page character counts for every page of the PDF document
-
openPage
final PdfPage openPage(Integer pageIndex)
Open page and store native pointer in PdfDocument
- Parameters:
pageIndex- the page index
-
deletePage
final Unit deletePage(Integer pageIndex)
Delete page
- Parameters:
pageIndex- the page index
-
openPages
final List<PdfPage> openPages(Integer fromIndex, Integer toIndex)
Open range of pages and store native pointers in PdfDocument
- Parameters:
fromIndex- the start index of the rangetoIndex- the end index of the range
-
renderPages
final Unit renderPages(Long bufferPtr, Integer drawSizeX, Integer drawSizeY, List<PdfPage> pages, List<Matrix> matrices, List<RectF> clipRects, Boolean renderAnnot, Boolean textMask, Integer canvasColor, Integer pageBackgroundColor)
Render page fragment on Surface.<br></br>
- Parameters:
bufferPtr- Surface's buffer on which to render pagepages- The pages to rendermatrices- The matrices to map the pages to the surfaceclipRects- The rectangles to clip the pages torenderAnnot- whether render annotationtextMask- whether to render text as image mask - currently ignoredcanvasColor- The color to fill the canvas with.pageBackgroundColor- The color for the page background.
-
renderPages
final Boolean renderPages(Surface surface, List<PdfPage> pages, List<Matrix> matrices, List<RectF> clipRects, Boolean renderAnnot, Boolean textMask, Integer canvasColor, Integer pageBackgroundColor)
-
getDocumentMeta
final PdfDocument.Meta getDocumentMeta()
Get metadata for given document
-
getTableOfContents
final List<PdfDocument.Bookmark> getTableOfContents()
Get table of contents (bookmarks) for given document
-
openTextPage
final PdfTextPage openTextPage(PdfPage page)
Open a text page
- Parameters:
page- the PdfPage
-
openTextPages
final List<PdfTextPage> openTextPages(Integer fromIndex, Integer toIndex)
Open a range of text pages
- Parameters:
fromIndex- the start index of the rangetoIndex- the end index of the range
-
saveAsCopy
final Boolean saveAsCopy(PdfWriteCallback callback, Integer flags)
Save document as a copy
- Parameters:
callback- the PdfWriteCallback to be called with the dataflags- must be one of FPDF_INCREMENTAL, FPDF_NO_INCREMENTAL or FPDF_REMOVE_SECURITY
-
-
-
-