Constructor and Description |
---|
ImageToImageClient(String userName,
String apiKey)
Constructor for the Pdfcrowd API client.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
convertFile(String file)
Convert a local file.
|
void |
convertFileToFile(String file,
String filePath)
Convert a local file and write the result to a local file.
|
void |
convertFileToStream(String file,
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,
String filePath)
Convert raw data to a file.
|
void |
convertRawDataToStream(byte[] data,
OutputStream outStream)
Convert raw data and write the result to an output stream.
|
byte[] |
convertStream(InputStream inStream)
Convert the contents of an input stream.
|
void |
convertStreamToFile(InputStream inStream,
String filePath)
Convert the contents of an input stream and write the result to a local file.
|
void |
convertStreamToStream(InputStream inStream,
OutputStream outStream)
Convert the contents of an input stream and write the result to an output stream.
|
byte[] |
convertUrl(String url)
Convert an image.
|
void |
convertUrlToFile(String url,
String filePath)
Convert an image and write the result to a local file.
|
void |
convertUrlToStream(String url,
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.
|
String |
getDebugLogUrl()
Get the URL of the debug log for the last conversion.
|
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.
|
String |
getVersion()
Get the version details.
|
Pdfcrowd.ImageToImageClient |
setCanvasBackgroundColor(String color)
The canvas background color in RGB or RGBA hexadecimal format.
|
Pdfcrowd.ImageToImageClient |
setCanvasDimensions(String width,
String height)
Set the output canvas dimensions.
|
Pdfcrowd.ImageToImageClient |
setCanvasHeight(String height)
Set the output canvas height.
|
Pdfcrowd.ImageToImageClient |
setCanvasSize(String size)
Set the output canvas size.
|
Pdfcrowd.ImageToImageClient |
setCanvasWidth(String width)
Set the output canvas width.
|
Pdfcrowd.ImageToImageClient |
setConverterVersion(String version)
Set the converter version.
|
Pdfcrowd.ImageToImageClient |
setCropArea(String x,
String y,
String width,
String height)
Set the content area position and size.
|
Pdfcrowd.ImageToImageClient |
setCropAreaHeight(String height)
Set the height of the content area.
|
Pdfcrowd.ImageToImageClient |
setCropAreaWidth(String width)
Set the width of the content area.
|
Pdfcrowd.ImageToImageClient |
setCropAreaX(String x)
Set the top left X coordinate of the content area.
|
Pdfcrowd.ImageToImageClient |
setCropAreaY(String y)
Set the top left Y coordinate of the content area.
|
Pdfcrowd.ImageToImageClient |
setDebugLog(boolean value)
Turn on the debug logging.
|
Pdfcrowd.ImageToImageClient |
setDpi(int dpi)
Set the DPI resolution of the input image.
|
Pdfcrowd.ImageToImageClient |
setHttpProxy(String proxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme.
|
Pdfcrowd.ImageToImageClient |
setHttpsProxy(String proxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme.
|
Pdfcrowd.ImageToImageClient |
setMarginBottom(String bottom)
Set the output canvas bottom margin.
|
Pdfcrowd.ImageToImageClient |
setMarginLeft(String left)
Set the output canvas left margin.
|
Pdfcrowd.ImageToImageClient |
setMarginRight(String right)
Set the output canvas right margin.
|
Pdfcrowd.ImageToImageClient |
setMargins(String top,
String right,
String bottom,
String left)
Set the output canvas margins.
|
Pdfcrowd.ImageToImageClient |
setMarginTop(String top)
Set the output canvas top margin.
|
Pdfcrowd.ImageToImageClient |
setOrientation(String orientation)
Set the output canvas orientation.
|
Pdfcrowd.ImageToImageClient |
setOutputFormat(String outputFormat)
The format of the output file.
|
Pdfcrowd.ImageToImageClient |
setPosition(String position)
Set the image position on the canvas.
|
Pdfcrowd.ImageToImageClient |
setPrintCanvasMode(String mode)
Set the mode to print the image on the canvas.
|
Pdfcrowd.ImageToImageClient |
setProxy(String host,
int port,
String userName,
String password)
Specifies an HTTP proxy that the API client library will use to connect to the internet.
|
Pdfcrowd.ImageToImageClient |
setRemoveBorders(boolean value)
Remove borders of an image which does not change in color.
|
Pdfcrowd.ImageToImageClient |
setResize(String resize)
Resize the image.
|
Pdfcrowd.ImageToImageClient |
setRetryCount(int count)
Specifies the number of automatic retries when the 502 HTTP status code is received.
|
Pdfcrowd.ImageToImageClient |
setRotate(String rotate)
Rotate the image.
|
Pdfcrowd.ImageToImageClient |
setTag(String tag)
Tag the conversion with a custom value.
|
Pdfcrowd.ImageToImageClient |
setUseHttp(boolean value)
Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
|
Pdfcrowd.ImageToImageClient |
setUserAgent(String agent)
Set a custom user agent HTTP header.
|
public byte[] convertUrl(String url)
url
- The address of the image to convert. The supported protocols are http:// and https://.public void convertUrlToStream(String url, 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(String url, String filePath) throws 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.IOException
public byte[] convertFile(String file)
file
- The path to a local file to convert.public void convertFileToStream(String file, OutputStream outStream)
file
- The path to a local file to convert.outStream
- The output stream that will contain the conversion output.public void convertFileToFile(String file, String filePath) throws IOException
file
- The path to a local file to convert.filePath
- The output file path. The string must not be empty.IOException
public byte[] convertRawData(byte[] data)
data
- The raw content to be converted.public void convertRawDataToStream(byte[] data, OutputStream outStream)
data
- The raw content to be converted.outStream
- The output stream that will contain the conversion output.public void convertRawDataToFile(byte[] data, String filePath) throws IOException
data
- The raw content to be converted.filePath
- The output file path. The string must not be empty.IOException
public byte[] convertStream(InputStream inStream) throws IOException
inStream
- The input stream with source data.IOException
public void convertStreamToStream(InputStream inStream, OutputStream outStream) throws IOException
inStream
- The input stream with source data.outStream
- The output stream that will contain the conversion output.IOException
public void convertStreamToFile(InputStream inStream, String filePath) throws IOException
inStream
- The input stream with source data.filePath
- The output file path. The string must not be empty.IOException
public Pdfcrowd.ImageToImageClient setOutputFormat(String outputFormat)
outputFormat
- Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.public Pdfcrowd.ImageToImageClient setResize(String resize)
resize
- The resize percentage or new image dimensions.public Pdfcrowd.ImageToImageClient setRotate(String rotate)
rotate
- The rotation specified in degrees.public Pdfcrowd.ImageToImageClient setCropAreaX(String x)
x
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCropAreaY(String y)
y
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCropAreaWidth(String width)
width
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCropAreaHeight(String height)
height
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCropArea(String x, String y, String width, String height)
x
- Set the top left X coordinate of the content area. It is relative to the top left X coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".y
- Set the top left Y coordinate of the content area. It is relative to the top left Y coordinate of the print area. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".width
- Set the width of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".height
- Set the height of the content area. It should be at least 1 inch. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setRemoveBorders(boolean value)
value
- Set to true to remove borders.public Pdfcrowd.ImageToImageClient setCanvasSize(String size)
size
- Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.public Pdfcrowd.ImageToImageClient setCanvasWidth(String width)
width
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCanvasHeight(String height)
height
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCanvasDimensions(String width, String height)
width
- Set the output canvas width. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".height
- Set the output canvas height. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setOrientation(String orientation)
orientation
- Allowed values are landscape, portrait.public Pdfcrowd.ImageToImageClient setPosition(String position)
position
- Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.public Pdfcrowd.ImageToImageClient setPrintCanvasMode(String mode)
mode
- Allowed values are default, fit, stretch.public Pdfcrowd.ImageToImageClient setMarginTop(String top)
top
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setMarginRight(String right)
right
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setMarginBottom(String bottom)
bottom
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setMarginLeft(String left)
left
- The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setMargins(String top, String right, String bottom, String left)
top
- Set the output canvas top margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".right
- Set the output canvas right margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".bottom
- Set the output canvas bottom margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".left
- Set the output canvas left margin. The value must be specified in inches "in", millimeters "mm", centimeters "cm", pixels "px", or points "pt".public Pdfcrowd.ImageToImageClient setCanvasBackgroundColor(String color)
color
- The value must be in RRGGBB or RRGGBBAA hexadecimal format.public Pdfcrowd.ImageToImageClient setDpi(int dpi)
dpi
- The DPI value.public Pdfcrowd.ImageToImageClient setDebugLog(boolean value)
value
- Set to true to enable the debug logging.public String getDebugLogUrl()
public int getRemainingCreditCount()
public int getConsumedCreditCount()
public String getJobId()
public int getOutputSize()
public String getVersion()
public Pdfcrowd.ImageToImageClient setTag(String tag)
tag
- A string with the custom tag.public Pdfcrowd.ImageToImageClient setHttpProxy(String proxy)
proxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToImageClient setHttpsProxy(String proxy)
proxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToImageClient setConverterVersion(String version)
version
- The version identifier. Allowed values are latest, 20.10, 18.10.public Pdfcrowd.ImageToImageClient setUseHttp(boolean value)
value
- Set to true to use HTTP.public Pdfcrowd.ImageToImageClient setUserAgent(String agent)
agent
- The user agent string.public Pdfcrowd.ImageToImageClient setProxy(String host, int port, String userName, String password)
host
- The proxy hostname.port
- The proxy port.userName
- The username.password
- The password.public Pdfcrowd.ImageToImageClient setRetryCount(int count)
count
- Number of retries.Copyright © 2023. All rights reserved.