Class DownloadRequest.Builder

    • Constructor Detail

      • DownloadRequest.Builder

        DownloadRequest.Builder(Context context)
        Create a builder with default settings.
        Parameters:
        context - Context for resolving resources.
    • Method Detail

      • uri

         DownloadRequest.Builder uri(@NonNull() Uri uri)

        Sets the download source from a Uri.

        Valid URI examples:

        • Content provider: content://com.pspdfkit.viewer/documents/demo.pdf
        • Asset paths: file://android_asset/demo.pdf
        • Web URLs: https://www.example.com/demo.pdf
        Parameters:
        uri - Uri of the document to download.
      • outputFolder

         DownloadRequest.Builder outputFolder(@NonNull() File outputFolder)

        Sets the outputFolder for the download. When using this method the PDF will use a generated filename derived from the system time. If you want to explicitly specify the output filename use outputFile instead.

        Parameters:
        outputFolder - File pointing to the download output directory.
      • overwriteExisting

         DownloadRequest.Builder overwriteExisting(boolean overwriteExisting)

        If set to true and the outputFile already exists, the download re-download the document. If set to false the download will complete immediately returning the existing file.

        Parameters:
        overwriteExisting - true to re-download in case the output file already exists.
      • useTemporaryOutputFile

         DownloadRequest.Builder useTemporaryOutputFile(boolean useTemporaryOutputFile)

        If set to true, the download will write to a temporary file with the same path and filename as the output file but append .tmp to it. If false the download will be written directly into the output file. Defaults to true.

        Parameters:
        useTemporaryOutputFile - true to use a temporary output file while downloading, or false to directly write into the ultimate output file.