Class PdfApiClientFactory

java.lang.Object
io.pdfapi.client.PdfApiClientFactory

public class PdfApiClientFactory extends Object
  • Constructor Details

    • PdfApiClientFactory

      public PdfApiClientFactory()
  • Method Details

    • createClient

      public static PdfApiClient createClient(PdfApiClientConfig config)
      Creates a new instance of PdfApiClient using the default HTTP client implementation (OkHttp). For specific HTTP client implementations, use createWithOkHttp(PdfApiClientConfig) or createWithApacheHttpClient(PdfApiClientConfig).
      Parameters:
      config - client configuration
      Returns:
      new client instance
    • createWithOkHttp

      public static PdfApiClient createWithOkHttp(PdfApiClientConfig config)
      Creates a new instance of PdfApiClient using OkHttp implementation with default configuration. This implementation is optimized for performance and is the recommended choice for most use cases.
      Parameters:
      config - client configuration
      Returns:
      new client instance
    • createWithOkHttp

      public static PdfApiClient createWithOkHttp(PdfApiClientConfig config, okhttp3.OkHttpClient okHttpClient)
      Creates a new instance of PdfApiClient using a pre-configured OkHttp client. Use this when you need to customize the OkHttp client configuration beyond timeouts.
      Parameters:
      config - client configuration
      okHttpClient - pre-configured OkHttp client instance
      Returns:
      new client instance
    • createWithApacheHttpClient

      public static PdfApiClient createWithApacheHttpClient(PdfApiClientConfig config)
      Creates a new instance of PdfApiClient using Apache HTTP Client implementation with default configuration. This implementation is provided as an alternative for environments where Apache HTTP Client is preferred or already in use.
      Parameters:
      config - client configuration
      Returns:
      new client instance
    • createWithApacheHttpClient

      public static PdfApiClient createWithApacheHttpClient(PdfApiClientConfig config, org.apache.http.impl.client.CloseableHttpClient httpClient)
      Creates a new instance of PdfApiClient using a pre-configured Apache HTTP client. Use this when you need to customize the Apache HTTP client configuration.
      Parameters:
      config - client configuration
      httpClient - pre-configured Apache HTTP client instance
      Returns:
      new client instance
    • createWithRestTemplate

      public static PdfApiClient createWithRestTemplate(PdfApiClientConfig config)
      Creates a new instance of PdfApiClient using Spring RestTemplate implementation with default configuration. This implementation is suitable for Spring-based applications.
      Parameters:
      config - client configuration
      Returns:
      new client instance
    • createWithRestTemplate

      public static PdfApiClient createWithRestTemplate(PdfApiClientConfig config, org.springframework.web.client.RestTemplate restTemplate)
      Creates a new instance of PdfApiClient using a pre-configured RestTemplate. Use this when you need to customize the RestTemplate configuration or share an existing instance.
      Parameters:
      config - client configuration
      restTemplate - pre-configured RestTemplate instance
      Returns:
      new client instance
    • createWithCustomHttpClient

      public static PdfApiClient createWithCustomHttpClient(PdfApiClientConfig config, HttpClient httpClient)
      Creates a new instance of PdfApiClient using custom HTTP client implementation. Use this method when you need to provide your own HTTP client implementation that conforms to the HttpClient interface.
      Parameters:
      config - client configuration
      httpClient - custom HTTP client implementation
      Returns:
      new client instance