Interface PdfProjection

  • All Implemented Interfaces:

    
    public interface PdfProjection
    
                        

    Projection between the normalized PDF coordinates and raw PDF coordinates. To retrieve an instance of this, use getPdfProjection. For more information on coordinate spaces and coordinate conversions, please refer to our Coordinate Space Conversion online guide.

    When working with coordinates on a PDF, PSPDFKit for Android will use a normalized coordinate space for simplified handling. This normalized coordinate space follows the WYSWIG principle ("What you see is what you get"). Within the normalized coordinate space, the coordinate `[0,0]` denotes the bottom left corner of the displayed page, and `[page width, page height]` denotes the top right corner of the displayed page. Note that PSPDFKit already accounts for any rotation that might be applied to the page, as well as page cropping using the page's `CropBox`. This means that `[0,0]` will always mark the bottom left corner of a page, independent of its rotation or cropping.

    While normalized coordinates greatly simplify coordinate handling for most scenarios, some use cases might require access to raw PDF coordinates. For those cases, this projection can be used to convert between PDF coordinates used by PSPDFKit, and the raw PDF coordinates that will be written into the underlying PDF document.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • toRawPoint

        @NonNull() abstract PointF toRawPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex)

        Maps a normalized PDF point to a raw PDF point. Converts the coordinates stored within point from the normalized PDF coordinate space of the given pageIndex to the raw PDF coordinate space (of the same page). This method modifies point in place.

        Parameters:
        point - Point in normalized PDF coordinates on the given pageIndex that should be converted to raw PDF coordinates of the same page.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toNormalizedPoint

        @NonNull() abstract PointF toNormalizedPoint(@NonNull() PointF point, @IntRange(from = 0) int pageIndex)

        Maps a raw PDF point to a normalized PDF point. Converts the coordinates stored within point from the raw PDF coordinate space of the given pageIndex to the normalized PDF coordinate space (of the same page). This method modifies point in place.

        Parameters:
        point - Point in raw PDF coordinates on the given pageIndex that should be converted to normalized PDF coordinates of the same page.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toRawRect

        @NonNull() abstract RectF toRawRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex)

        Maps a normalized PDF rect to a raw PDF rect. Converts the coordinates stored within rect from the normalized PDF coordinate space of the given pageIndex to the raw PDF coordinate space (of the same page). This method modifies rect in place.

        Parameters:
        rect - Rect in normalized PDF coordinates on the given pageIndex that should be converted to raw PDF coordinates of the same page.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • toPdfRect

        @NonNull() abstract RectF toPdfRect(@NonNull() RectF rect, @IntRange(from = 0) int pageIndex)

        Maps a raw PDF rect to a normalized PDF rect. Converts the coordinates stored within rect from the raw PDF coordinate space of the given pageIndex to the normalized PDF coordinate space (of the same page). This method modifies rect in place.

        Parameters:
        rect - Rect in raw PDF coordinates on the given pageIndex that should be converted to normalized PDF coordinates of the same page.
        pageIndex - Target page for the conversion (0 denotes the first page).
      • getNormalizedToRawTransformation

        @NonNull() abstract Matrix getNormalizedToRawTransformation(@IntRange(from = 0) int pageIndex)

        Returns a transformation matrix for converting normalized page coordinates (for the given pageIndex) to raw page coordinates.

        Parameters:
        pageIndex - Number of the page for which to retrieve the transformation (0 denotes the first page).
        Returns:

        Transformation matrix for converting normalized page coordinates to raw page coordinates.

      • getRawToNormalizedTransformation

        @NonNull() abstract Matrix getRawToNormalizedTransformation(@IntRange(from = 0) int pageIndex)

        Returns a transformation matrix for converting raw page coordinates (for the given pageIndex) to normalized page coordinates.

        Parameters:
        pageIndex - Number of the page for which to retrieve the transformation (0 denotes the first page).
        Returns:

        Transformation matrix for converting raw page coordinates to normalized page coordinates.