| Constructor and Description |
|---|
ImageToPdfClient(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.ImageToPdfClient |
setAuthor(String author)
Set the author of the PDF.
|
Pdfcrowd.ImageToPdfClient |
setCenterWindow(boolean value)
Specify whether to position the document's window in the center of the screen.
|
Pdfcrowd.ImageToPdfClient |
setClientUserAgent(String agent)
Specifies the User-Agent HTTP header that the client library will use when interacting with the API.
|
Pdfcrowd.ImageToPdfClient |
setConverterVersion(String version)
Set the converter version.
|
Pdfcrowd.ImageToPdfClient |
setCropArea(String x,
String y,
String width,
String height)
Set the content area position and size.
|
Pdfcrowd.ImageToPdfClient |
setCropAreaHeight(String height)
Set the height of the content area.
|
Pdfcrowd.ImageToPdfClient |
setCropAreaWidth(String width)
Set the width of the content area.
|
Pdfcrowd.ImageToPdfClient |
setCropAreaX(String x)
Set the top left X coordinate of the content area.
|
Pdfcrowd.ImageToPdfClient |
setCropAreaY(String y)
Set the top left Y coordinate of the content area.
|
Pdfcrowd.ImageToPdfClient |
setDebugLog(boolean value)
Turn on the debug logging.
|
Pdfcrowd.ImageToPdfClient |
setDisplayTitle(boolean value)
Specify whether the window's title bar should display the document title.
|
Pdfcrowd.ImageToPdfClient |
setDpi(int dpi)
Set the DPI resolution of the input image.
|
Pdfcrowd.ImageToPdfClient |
setEncrypt(boolean value)
Encrypt the PDF.
|
Pdfcrowd.ImageToPdfClient |
setFitWindow(boolean value)
Specify whether to resize the document's window to fit the size of the first displayed page.
|
Pdfcrowd.ImageToPdfClient |
setHideMenubar(boolean value)
Specify whether to hide the viewer application's menu bar when the document is active.
|
Pdfcrowd.ImageToPdfClient |
setHideToolbar(boolean value)
Specify whether to hide the viewer application's tool bars when the document is active.
|
Pdfcrowd.ImageToPdfClient |
setHideWindowUi(boolean value)
Specify whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
|
Pdfcrowd.ImageToPdfClient |
setHttpProxy(String proxy)
A proxy server used by the conversion process for accessing the source URLs with HTTP scheme.
|
Pdfcrowd.ImageToPdfClient |
setHttpsProxy(String proxy)
A proxy server used by the conversion process for accessing the source URLs with HTTPS scheme.
|
Pdfcrowd.ImageToPdfClient |
setInitialPage(int page)
Display the specified page when the document is opened.
|
Pdfcrowd.ImageToPdfClient |
setInitialZoom(int zoom)
Specify the initial page zoom in percents when the document is opened.
|
Pdfcrowd.ImageToPdfClient |
setInitialZoomType(String zoomType)
Specify how the page should be displayed when opened.
|
Pdfcrowd.ImageToPdfClient |
setKeywords(String keywords)
Associate keywords with the document.
|
Pdfcrowd.ImageToPdfClient |
setLinearize(boolean value)
Create linearized PDF.
|
Pdfcrowd.ImageToPdfClient |
setMarginBottom(String bottom)
Set the output page bottom margin.
|
Pdfcrowd.ImageToPdfClient |
setMarginLeft(String left)
Set the output page left margin.
|
Pdfcrowd.ImageToPdfClient |
setMarginRight(String right)
Set the output page right margin.
|
Pdfcrowd.ImageToPdfClient |
setMarginTop(String top)
Set the output page top margin.
|
Pdfcrowd.ImageToPdfClient |
setMultipageBackground(String background)
Apply each page of a background to the corresponding page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setMultipageBackgroundUrl(String url)
Load a file from the specified URL and apply each page of the file as a background to the corresponding page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setMultipageWatermark(String watermark)
Apply each page of a watermark to the corresponding page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setMultipageWatermarkUrl(String url)
Load a file from the specified URL and apply each page of the file as a watermark to the corresponding page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setNoCopy(boolean value)
Disallow text and graphics extraction from the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setNoModify(boolean value)
Disallow modification of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setNoPrint(boolean value)
Disallow printing of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setOrientation(String orientation)
Set the output page orientation.
|
Pdfcrowd.ImageToPdfClient |
setOwnerPassword(String password)
Protect the PDF with an owner password.
|
Pdfcrowd.ImageToPdfClient |
setPageBackground(String background)
Apply a background to each page of the output PDF file.
|
Pdfcrowd.ImageToPdfClient |
setPageBackgroundColor(String color)
The page background color in RGB or RGBA hexadecimal format.
|
Pdfcrowd.ImageToPdfClient |
setPageBackgroundUrl(String url)
Load a file from the specified URL and apply the file as a background to each page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setPageDimensions(String width,
String height)
Set the output page dimensions.
|
Pdfcrowd.ImageToPdfClient |
setPageHeight(String height)
Set the output page height.
|
Pdfcrowd.ImageToPdfClient |
setPageLayout(String layout)
Specify the page layout to be used when the document is opened.
|
Pdfcrowd.ImageToPdfClient |
setPageMargins(String top,
String right,
String bottom,
String left)
Set the output page margins.
|
Pdfcrowd.ImageToPdfClient |
setPageMode(String mode)
Specify how the document should be displayed when opened.
|
Pdfcrowd.ImageToPdfClient |
setPageSize(String size)
Set the output page size.
|
Pdfcrowd.ImageToPdfClient |
setPageWatermark(String watermark)
Apply a watermark to each page of the output PDF file.
|
Pdfcrowd.ImageToPdfClient |
setPageWatermarkUrl(String url)
Load a file from the specified URL and apply the file as a watermark to each page of the output PDF.
|
Pdfcrowd.ImageToPdfClient |
setPageWidth(String width)
Set the output page width.
|
Pdfcrowd.ImageToPdfClient |
setPosition(String position)
Set the image position on the page.
|
Pdfcrowd.ImageToPdfClient |
setPrintPageMode(String mode)
Set the mode to print the image on the content area of the page.
|
Pdfcrowd.ImageToPdfClient |
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.ImageToPdfClient |
setRemoveBorders(boolean value)
Remove borders of an image which does not change in color.
|
Pdfcrowd.ImageToPdfClient |
setResize(String resize)
Resize the image.
|
Pdfcrowd.ImageToPdfClient |
setRetryCount(int count)
Specifies the number of automatic retries when the 502 or 503 HTTP status code is received.
|
Pdfcrowd.ImageToPdfClient |
setRotate(String rotate)
Rotate the image.
|
Pdfcrowd.ImageToPdfClient |
setSubject(String subject)
Set the subject of the PDF.
|
Pdfcrowd.ImageToPdfClient |
setTag(String tag)
Tag the conversion with a custom value.
|
Pdfcrowd.ImageToPdfClient |
setTitle(String title)
Set the title of the PDF.
|
Pdfcrowd.ImageToPdfClient |
setUseHttp(boolean value)
Specify whether to use HTTP or HTTPS when connecting to the PDFCrowd API.
|
Pdfcrowd.ImageToPdfClient |
setUserAgent(String agent)
Set a custom user agent HTTP header.
|
Pdfcrowd.ImageToPdfClient |
setUserPassword(String password)
Protect the PDF with a user password.
|
public byte[] convertUrl(String url)
url - The address of the image to convert. Supported protocols are http:// and https://.public void convertUrlToStream(String url, OutputStream outStream)
url - The address of the image to convert. 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. Supported protocols are http:// and https://.filePath - The output file path. The string must not be empty.IOExceptionpublic 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.IOExceptionpublic 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.IOExceptionpublic byte[] convertStream(InputStream inStream) throws IOException
inStream - The input stream with source data.IOExceptionpublic 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.IOExceptionpublic 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.IOExceptionpublic Pdfcrowd.ImageToPdfClient setResize(String resize)
resize - The resize percentage or new image dimensions.public Pdfcrowd.ImageToPdfClient setRotate(String rotate)
rotate - The rotation specified in degrees.public Pdfcrowd.ImageToPdfClient setCropAreaX(String x)
x - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setCropAreaY(String y)
y - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setCropAreaWidth(String width)
width - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setCropAreaHeight(String height)
height - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient 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.ImageToPdfClient setRemoveBorders(boolean value)
value - Set to true to remove borders.public Pdfcrowd.ImageToPdfClient setPageSize(String size)
size - Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.public Pdfcrowd.ImageToPdfClient setPageWidth(String width)
width - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setPageHeight(String height)
height - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setPageDimensions(String width, String height)
width - Set the output page width. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.height - Set the output page height. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setOrientation(String orientation)
orientation - Allowed values are landscape, portrait.public Pdfcrowd.ImageToPdfClient setPosition(String position)
position - Allowed values are center, top, bottom, left, right, top-left, top-right, bottom-left, bottom-right.public Pdfcrowd.ImageToPdfClient setPrintPageMode(String mode)
mode - Allowed values are default, fit, stretch.public Pdfcrowd.ImageToPdfClient setMarginTop(String top)
top - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setMarginRight(String right)
right - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setMarginBottom(String bottom)
bottom - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setMarginLeft(String left)
left - The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setPageMargins(String top, String right, String bottom, String left)
top - Set the output page top margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.right - Set the output page right margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.bottom - Set the output page bottom margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.left - Set the output page left margin. The value must be specified in inches 'in', millimeters 'mm', centimeters 'cm', pixels 'px', or points 'pt'.public Pdfcrowd.ImageToPdfClient setPageBackgroundColor(String color)
color - The value must be in RRGGBB or RRGGBBAA hexadecimal format.public Pdfcrowd.ImageToPdfClient setDpi(int dpi)
dpi - The DPI value.public Pdfcrowd.ImageToPdfClient setPageWatermark(String watermark)
watermark - The file path to a local file. The file must exist and not be empty.public Pdfcrowd.ImageToPdfClient setPageWatermarkUrl(String url)
url - Supported protocols are http:// and https://.public Pdfcrowd.ImageToPdfClient setMultipageWatermark(String watermark)
watermark - The file path to a local file. The file must exist and not be empty.public Pdfcrowd.ImageToPdfClient setMultipageWatermarkUrl(String url)
url - Supported protocols are http:// and https://.public Pdfcrowd.ImageToPdfClient setPageBackground(String background)
background - The file path to a local file. The file must exist and not be empty.public Pdfcrowd.ImageToPdfClient setPageBackgroundUrl(String url)
url - Supported protocols are http:// and https://.public Pdfcrowd.ImageToPdfClient setMultipageBackground(String background)
background - The file path to a local file. The file must exist and not be empty.public Pdfcrowd.ImageToPdfClient setMultipageBackgroundUrl(String url)
url - Supported protocols are http:// and https://.public Pdfcrowd.ImageToPdfClient setLinearize(boolean value)
value - Set to true to create linearized PDF.public Pdfcrowd.ImageToPdfClient setEncrypt(boolean value)
value - Set to true to enable PDF encryption.public Pdfcrowd.ImageToPdfClient setUserPassword(String password)
password - The user password.public Pdfcrowd.ImageToPdfClient setOwnerPassword(String password)
password - The owner password.public Pdfcrowd.ImageToPdfClient setNoPrint(boolean value)
value - Set to true to set the no-print flag in the output PDF.public Pdfcrowd.ImageToPdfClient setNoModify(boolean value)
value - Set to true to set the read-only only flag in the output PDF.public Pdfcrowd.ImageToPdfClient setNoCopy(boolean value)
value - Set to true to set the no-copy flag in the output PDF.public Pdfcrowd.ImageToPdfClient setTitle(String title)
title - The title.public Pdfcrowd.ImageToPdfClient setSubject(String subject)
subject - The subject.public Pdfcrowd.ImageToPdfClient setAuthor(String author)
author - The author.public Pdfcrowd.ImageToPdfClient setKeywords(String keywords)
keywords - The string with the keywords.public Pdfcrowd.ImageToPdfClient setPageLayout(String layout)
layout - Allowed values are single-page, one-column, two-column-left, two-column-right.public Pdfcrowd.ImageToPdfClient setPageMode(String mode)
mode - Allowed values are full-screen, thumbnails, outlines.public Pdfcrowd.ImageToPdfClient setInitialZoomType(String zoomType)
zoomType - Allowed values are fit-width, fit-height, fit-page.public Pdfcrowd.ImageToPdfClient setInitialPage(int page)
page - Must be a positive integer.public Pdfcrowd.ImageToPdfClient setInitialZoom(int zoom)
zoom - Must be a positive integer.public Pdfcrowd.ImageToPdfClient setHideToolbar(boolean value)
value - Set to true to hide tool bars.public Pdfcrowd.ImageToPdfClient setHideMenubar(boolean value)
value - Set to true to hide the menu bar.public Pdfcrowd.ImageToPdfClient setHideWindowUi(boolean value)
value - Set to true to hide ui elements.public Pdfcrowd.ImageToPdfClient setFitWindow(boolean value)
value - Set to true to resize the window.public Pdfcrowd.ImageToPdfClient setCenterWindow(boolean value)
value - Set to true to center the window.public Pdfcrowd.ImageToPdfClient setDisplayTitle(boolean value)
value - Set to true to display the title.public Pdfcrowd.ImageToPdfClient setDebugLog(boolean value)
value - Set to true to enable the debug logging.public String getDebugLogUrl()
public int getRemainingCreditCount()
999999 is returned if the information is not available.public int getConsumedCreditCount()
public String getJobId()
public int getOutputSize()
public String getVersion()
public Pdfcrowd.ImageToPdfClient setTag(String tag)
tag - A string with the custom tag.public Pdfcrowd.ImageToPdfClient setHttpProxy(String proxy)
proxy - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToPdfClient setHttpsProxy(String proxy)
proxy - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.ImageToPdfClient setConverterVersion(String version)
version - The version identifier. Allowed values are 24.04, 20.10, 18.10, latest.public Pdfcrowd.ImageToPdfClient setUseHttp(boolean value)
value - Set to true to use HTTP.public Pdfcrowd.ImageToPdfClient setClientUserAgent(String agent)
agent - The user agent string.public Pdfcrowd.ImageToPdfClient setUserAgent(String agent)
agent - The user agent string.public Pdfcrowd.ImageToPdfClient 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.ImageToPdfClient setRetryCount(int count)
count - Number of retries.Copyright © 2025. All rights reserved.