com.foxit.gsdk.pdf

Class PDFReflowPage

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int REFLOWFLAG_IMAGE
      Reflow parsing flag for image mode.
      static int REFLOWFLAG_NORMAL
      Reflow parsing flag for normal mode, without image.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      static PDFReflowPage create(PDFPage page)
      Create a PDFReflowPage object from specified PDFPage object.
      SizeF getContentSize()
      Get width and height of a reflow page after calling function startParse(int).
      java.lang.String getFocusData(Matrix matrix, java.awt.Point point)
      Get focus data corresponding to a given position in device coordinate system.
      java.awt.Point getFocusPos(Matrix matrix, java.lang.String focusData)
      Get a point position in device coordinate system which corresponds to a given focus data.
      long getHandle()
      Get a reflow page handle.
      Matrix getMatrix(int x, int y, int width, int height, int rotation)
      Get matrix of a PDFReflowPage object.
      void release()
      Release all resources allocated for a PDFReflowPage handle.
      void setLineSpace(float lineSpace)
      Set line space before calling function startParse(int).
      void setSize(float width, float height)
      Set screen size before calling function startParse(int).
      Progress startParse(int flags)
      Start parsing process for a PDFReflowPage object.
      Progress startRender(RenderContext context, Renderer render)
      Start rendering a reflowed page.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • REFLOWFLAG_NORMAL

        public static final int REFLOWFLAG_NORMAL
        Reflow parsing flag for normal mode, without image.
        See Also:
        Constant Field Values
      • REFLOWFLAG_IMAGE

        public static final int REFLOWFLAG_IMAGE
        Reflow parsing flag for image mode.
        See Also:
        Constant Field Values
    • Method Detail

      • getHandle

        public long getHandle()
        Get a reflow page handle.
        Returns:
        A reflow page handle.
      • getMatrix

        public Matrix getMatrix(int x,
                       int y,
                       int width,
                       int height,
                       int rotation)
                         throws PDFException
        Get matrix of a PDFReflowPage object.
        Parameters:
        x - Left pixel position of the display area in the device coordinate system.
        y - Top pixel position of the display area in the device coordinate system.
        width - Horizontal size (in pixels) to display the page.
        height - Vertical size (in pixels) to display the page.
        rotation - Page orientation. Valid values are:
        • 0: Normal
        • 1: Rotate 90 degrees clockwise
        • 2: Rotate 180 degrees
        • 3: Rotate 90 degrees counter-clockwise
        Returns:
        A Matrix object that receives the output matrix.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException
      • setSize

        public void setSize(float width,
                   float height)
                     throws PDFException
        Set screen size before calling function startParse(int).
        Parameters:
        width - Width of desired page. This value should be more than 20.
        height - Height of desired page. This value should be more than 20.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException
      • getFocusData

        public java.lang.String getFocusData(Matrix matrix,
                                    java.awt.Point point)
                                      throws PDFException
        Get focus data corresponding to a given position in device coordinate system.
        Parameters:
        matrix - A Matrix object returned by function getMatrix.
        point - A Point object that is a specific position, in device coordinate system.
        Returns:
        A String object that receives the focus data corresponding to the specific position.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException
      • getFocusPos

        public java.awt.Point getFocusPos(Matrix matrix,
                                 java.lang.String focusData)
                                   throws PDFException
        Get a point position in device coordinate system which corresponds to a given focus data.
        Parameters:
        matrix - A Matrix object returned by function getMatrix(int, int, int, int, int).
        focusData - Focus data used to get its corresponding position in device coordinate system, with specific matrix. This is returned by function getFocusData(Matrix, Point).
        Returns:
        A Point object that receives the position corresponding to the specific focus data.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException
      • startParse

        public Progress startParse(int flags)
                            throws PDFException
        Start parsing process for a PDFReflowPage object.

        It may take a long time for parsing a reflow page, so Foxit PDF SDK uses a progressive process.
        All the resources about reflow page will be loaded after the reflow page is parsed.
        Function setSize(float, float) must be called before this function to set the screen size. And this function should be called before any method of the reflow module can be used.

        Parameters:
        flags - Reflow parsing mode. It should be one of the followings:
        Returns:
        A Progress object that receives a handle of progressive process if success.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException, Progress
      • startRender

        public Progress startRender(RenderContext context,
                           Renderer render)
                             throws PDFException
        Start rendering a reflowed page.

        It will take a long time to render a reflowed page with complex or large contents, so Foxit PDF SDK uses a progressive process.

        Parameters:
        context - Handle to a RenderContext object which is a PDF rendering context.
        render - Handle to a Renderer object which represents a rendering engine.
        Returns:
        A Progress object that receives a handle of progressive process if successful.
        Throws:
        PDFException - For more exception information please see definitions PDFException.ERRCODE_XXX .
        See Also:
        PDFException, Progress, RenderContext, Renderer