public static final class Pdfcrowd.ImageToPdfClient
extends java.lang.Object
Constructor and Description |
---|
ImageToPdfClient(java.lang.String userName,
java.lang.String apiKey)
Constructor for the Pdfcrowd API client.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
convertFile(java.lang.String file)
Convert a local file.
|
void |
convertFileToFile(java.lang.String file,
java.lang.String filePath)
Convert a local file and write the result to a local file.
|
void |
convertFileToStream(java.lang.String file,
java.io.OutputStream outStream)
Convert a local file and write the result to an output stream.
|
byte[] |
convertRawData(byte[] data)
Convert raw data.
|
void |
convertRawDataToFile(byte[] data,
java.lang.String filePath)
Convert raw data to a file.
|
void |
convertRawDataToStream(byte[] data,
java.io.OutputStream outStream)
Convert raw data and write the result to an output stream.
|
byte[] |
convertUrl(java.lang.String url)
Convert an image.
|
void |
convertUrlToFile(java.lang.String url,
java.lang.String filePath)
Convert an image and write the result to a local file.
|
void |
convertUrlToStream(java.lang.String url,
java.io.OutputStream outStream)
Convert an image and write the result to an output stream.
|
int |
getConsumedCreditCount()
Get the number of credits consumed by the last conversion.
|
java.lang.String |
getDebugLogUrl()
Get the URL of the debug log for the last conversion.
|
java.lang.String |
getJobId()
Get the job id.
|
int |
getOutputSize()
Get the size of the output in bytes.
|
int |
getRemainingCreditCount()
Get the number of conversion credits available in your account.
|
Pdfcrowd.ImageToPdfClient |
setDebugLog(boolean debugLog)
Turn on the debug logging.
|
Pdfcrowd.ImageToPdfClient |
setHttpProxy(java.lang.String httpProxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme.
|
Pdfcrowd.ImageToPdfClient |
setHttpsProxy(java.lang.String httpsProxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme.
|
Pdfcrowd.ImageToPdfClient |
setProxy(java.lang.String host,
int port,
java.lang.String userName,
java.lang.String password)
Specifies an HTTP proxy that the API client library will use to connect to the internet.
|
Pdfcrowd.ImageToPdfClient |
setResize(java.lang.String resize)
Resize the image.
|
Pdfcrowd.ImageToPdfClient |
setRetryCount(int retryCount)
Specifies the number of retries when the 502 HTTP status code is received.
|
Pdfcrowd.ImageToPdfClient |
setRotate(java.lang.String rotate)
Rotate the image.
|
Pdfcrowd.ImageToPdfClient |
setTag(java.lang.String tag)
Tag the conversion with a custom value.
|
Pdfcrowd.ImageToPdfClient |
setUseHttp(boolean useHttp)
Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
|
Pdfcrowd.ImageToPdfClient |
setUserAgent(java.lang.String userAgent)
Set a custom user agent HTTP header.
|
public ImageToPdfClient(java.lang.String userName, java.lang.String apiKey)
userName
- Your username at Pdfcrowd.apiKey
- Your API key.public byte[] convertUrl(java.lang.String url)
url
- The address of the image to convert. The supported protocols are http:// and https://.public void convertUrlToStream(java.lang.String url, java.io.OutputStream outStream)
url
- The address of the image to convert. The supported protocols are http:// and https://.outStream
- The output stream that will contain the conversion output.public void convertUrlToFile(java.lang.String url, java.lang.String filePath) throws java.io.IOException
url
- The address of the image to convert. The supported protocols are http:// and https://.filePath
- The output file path. The string must not be empty.java.io.IOException
public byte[] convertFile(java.lang.String file)
file
- The path to a local file to convert.public void convertFileToStream(java.lang.String file, java.io.OutputStream outStream)
file
- The path to a local file to convert.outStream
- The output stream that will contain the conversion output.public void convertFileToFile(java.lang.String file, java.lang.String filePath) throws java.io.IOException
file
- The path to a local file to convert.filePath
- The output file path. The string must not be empty.java.io.IOException
public byte[] convertRawData(byte[] data)
data
- The raw content to be converted.public void convertRawDataToStream(byte[] data, java.io.OutputStream outStream)
data
- The raw content to be converted.outStream
- The output stream that will contain the conversion output.public void convertRawDataToFile(byte[] data, java.lang.String filePath) throws java.io.IOException
data
- The raw content to be converted.filePath
- The output file path. The string must not be empty.java.io.IOException
public Pdfcrowd.ImageToPdfClient setResize(java.lang.String resize)
resize
- The resize percentage or new image dimensions.public Pdfcrowd.ImageToPdfClient setRotate(java.lang.String rotate)
rotate
- The rotation specified in degrees.public Pdfcrowd.ImageToPdfClient setDebugLog(boolean debugLog)
debugLog
- Set to true to enable the debug logging.public java.lang.String getDebugLogUrl()
public int getRemainingCreditCount()
public int getConsumedCreditCount()
public java.lang.String getJobId()
public int getOutputSize()
public Pdfcrowd.ImageToPdfClient setTag(java.lang.String tag)
tag
- A string with the custom tag.public Pdfcrowd.ImageToPdfClient setHttpProxy(java.lang.String httpProxy)
httpProxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToPdfClient setHttpsProxy(java.lang.String httpsProxy)
httpsProxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToPdfClient setUseHttp(boolean useHttp)
useHttp
- Set to true to use HTTP.public Pdfcrowd.ImageToPdfClient setUserAgent(java.lang.String userAgent)
userAgent
- The user agent string.public Pdfcrowd.ImageToPdfClient setProxy(java.lang.String host, int port, java.lang.String userName, java.lang.String password)
host
- The proxy hostname.port
- The proxy port.userName
- The username.password
- The password.public Pdfcrowd.ImageToPdfClient setRetryCount(int retryCount)
retryCount
- Number of retries wanted.Copyright © 2019. All rights reserved.