public interface

ResourceInterceptor

com.pspdfkit.document.html.ResourceInterceptor

Class Overview

Used to intercept resource requests in HtmlToPdfConverter to allow providing custom data for these resources.

Summary

Public Methods
abstract ResourceResponse shouldInterceptRequest(ResourceRequest request)
Called when the HTML converter wants to loads a resource (image, stylesheet, JavaScript etc.).

Public Methods

public abstract ResourceResponse shouldInterceptRequest (ResourceRequest request)

Called when the HTML converter wants to loads a resource (image, stylesheet, JavaScript etc.).

This method is invoked for most supported URI schemes ("http(s):", "file:" etc.) and is not limited to requests made over the network. This is not called for "javascript:", "data:" and "blob:" schemes as well as for Android assets ("file:///android_asset/") or Android resources ("file:///android_res/").

If the source requires redirects, this method is called only for the initial base URL, not for the redirect URLs.

This method is called on the background thread.

Returns
  • Response for resource request with resource data, null to proceed with loading the resource as usual and skipResource() to skip loading the resource.