Package 

Class PdfiumCore

    • Constructor Detail

      • PdfiumCore

        PdfiumCore(Context ctx)
        Context needed to get screen density
    • Method Detail

      • getPageWidth

         int getPageWidth(PdfDocument doc, int index)

        Get page width in pixels. This method requires page to be opened.

      • getPageHeight

         int getPageHeight(PdfDocument doc, int index)

        Get page height in pixels. This method requires page to be opened.

      • getPageWidthPoint

         int getPageWidthPoint(PdfDocument doc, int index)

        Get page width in PostScript points (1/72th of an inch).This method requires page to be opened.

      • getPageHeightPoint

         int getPageHeightPoint(PdfDocument doc, int index)

        Get page height in PostScript points (1/72th of an inch).This method requires page to be opened.

      • getPageSize

         Size getPageSize(PdfDocument doc, int index)

        Get size of page in pixels.This method does not require given page to be opened.

      • renderPage

         void renderPage(PdfDocument doc, Surface surface, int pageIndex, int startX, int startY, int drawSizeX, int drawSizeY)

        Render page fragment on Surface.Page must be opened before rendering.

      • renderPage

         void renderPage(PdfDocument doc, Surface surface, int pageIndex, int startX, int startY, int drawSizeX, int drawSizeY, boolean renderAnnot)

        Render page fragment on Surface. This method allows to render annotations.Page must be opened before rendering.

      • renderPageBitmap

         void renderPageBitmap(PdfDocument doc, Bitmap bitmap, int pageIndex, int startX, int startY, int drawSizeX, int drawSizeY)

        Render page fragment on Bitmap.Page must be opened before rendering.

        Supported bitmap configurations:

        • ARGB_8888 - best quality, high memory usage, higher possibility of OutOfMemoryError
        • RGB_565 - little worse quality, twice less memory usage
      • renderPageBitmap

         void renderPageBitmap(PdfDocument doc, Bitmap bitmap, int pageIndex, int startX, int startY, int drawSizeX, int drawSizeY, boolean renderAnnot)

        Render page fragment on Bitmap. This method allows to render annotations.Page must be opened before rendering.

        For more info see renderPageBitmap

      • mapPageCoordsToDevice

         Point mapPageCoordsToDevice(PdfDocument doc, int pageIndex, int startX, int startY, int sizeX, int sizeY, int rotate, double pageX, double pageY)

        Map page coordinates to device screen coordinates

        Parameters:
        doc - pdf document
        pageIndex - index of page
        startX - left pixel position of the display area in device coordinates
        startY - top pixel position of the display area in device coordinates
        sizeX - horizontal size (in pixels) for displaying the page
        sizeY - vertical size (in pixels) for displaying the page
        rotate - page orientation: 0 (normal), 1 (rotated 90 degrees clockwise),2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)
        pageX - X value in page coordinates
        pageY - Y value in page coordinate
      • mapDeviceCoordsToPage

         PointF mapDeviceCoordsToPage(PdfDocument doc, int pageIndex, int startX, int startY, int sizeX, int sizeY, int rotate, int deviceX, int deviceY)

        Add commentMore actionsConvert the screen coordinates of a point to page coordinates.The page coordinate system has its origin at the left-bottom cornerof the page, with the X-axis on the bottom going to the right, andthe Y-axis on the left side going up.NOTE: this coordinate system can be altered when you zoom, scroll,or rotate a page, however, a point on the page should always havethe same coordinate values in the page coordinate system.The device coordinate system is device dependent. For screen device,its origin is at the left-top corner of the window. However thisorigin can be altered by the Windows coordinate transformationutilities.You must make sure the start_x, start_y, size_x, size_yand rotate parameters have exactly same values as you used inthe FPDF_RenderPage() function call.

        Parameters:
        doc - pdf document
        pageIndex - index of page
        startX - Left pixel position of the display area in device coordinates.
        startY - Top pixel position of the display area in device coordinates.
        sizeX - Horizontal size (in pixels) for displaying the page.
        sizeY - Vertical size (in pixels) for displaying the page.
        rotate - Page orientation:0 (normal)1 (rotated 90 degrees clockwise)2 (rotated 180 degrees)3 (rotated 90 degrees counter-clockwise)
        deviceX - X value in device coordinates to be converted.
        deviceY - Y value in device coordinates to be converted.