Constructor and Description |
---|
PdfToTextClient(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 a PDF.
|
void |
convertUrlToFile(String url,
String filePath)
Convert a PDF and write the result to a local file.
|
void |
convertUrlToStream(String url,
OutputStream outStream)
Convert a PDF 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 |
getPageCount()
Get the number of pages in the output document.
|
int |
getRemainingCreditCount()
Get the number of conversion credits available in your account.
|
String |
getVersion()
Get the version details.
|
Pdfcrowd.PdfToTextClient |
setCropArea(int x,
int y,
int width,
int height)
Set the crop area.
|
Pdfcrowd.PdfToTextClient |
setCropAreaHeight(int height)
Set the height of the crop area in points.
|
Pdfcrowd.PdfToTextClient |
setCropAreaWidth(int width)
Set the width of the crop area in points.
|
Pdfcrowd.PdfToTextClient |
setCropAreaX(int x)
Set the top left X coordinate of the crop area in points.
|
Pdfcrowd.PdfToTextClient |
setCropAreaY(int y)
Set the top left Y coordinate of the crop area in points.
|
Pdfcrowd.PdfToTextClient |
setCustomPageBreak(String pageBreak)
Specify the custom page break.
|
Pdfcrowd.PdfToTextClient |
setDebugLog(boolean value)
Turn on the debug logging.
|
Pdfcrowd.PdfToTextClient |
setEol(String eol)
The end-of-line convention for the text output.
|
Pdfcrowd.PdfToTextClient |
setHttpProxy(String proxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme.
|
Pdfcrowd.PdfToTextClient |
setHttpsProxy(String proxy)
A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme.
|
Pdfcrowd.PdfToTextClient |
setLineSpacingThreshold(String threshold)
Set the maximum line spacing when the paragraph detection mode is enabled.
|
Pdfcrowd.PdfToTextClient |
setNoLayout(boolean value)
Ignore the original PDF layout.
|
Pdfcrowd.PdfToTextClient |
setPageBreakMode(String mode)
Specify the page break mode for the text output.
|
Pdfcrowd.PdfToTextClient |
setParagraphMode(String mode)
Specify the paragraph detection mode.
|
Pdfcrowd.PdfToTextClient |
setPdfPassword(String password)
The password to open the encrypted PDF file.
|
Pdfcrowd.PdfToTextClient |
setPrintPageRange(String pages)
Set the page range to print.
|
Pdfcrowd.PdfToTextClient |
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.PdfToTextClient |
setRemoveEmptyLines(boolean value)
Remove empty lines from the text output.
|
Pdfcrowd.PdfToTextClient |
setRemoveHyphenation(boolean value)
Remove the hyphen character from the end of lines.
|
Pdfcrowd.PdfToTextClient |
setRetryCount(int count)
Specifies the number of automatic retries when the 502 HTTP status code is received.
|
Pdfcrowd.PdfToTextClient |
setTag(String tag)
Tag the conversion with a custom value.
|
Pdfcrowd.PdfToTextClient |
setUseHttp(boolean value)
Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
|
Pdfcrowd.PdfToTextClient |
setUserAgent(String agent)
Set a custom user agent HTTP header.
|
public byte[] convertUrl(String url)
url
- The address of the PDF to convert. The supported protocols are http:// and https://.public void convertUrlToStream(String url, OutputStream outStream)
url
- The address of the PDF 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 PDF 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.PdfToTextClient setPdfPassword(String password)
password
- The input PDF password.public Pdfcrowd.PdfToTextClient setPrintPageRange(String pages)
pages
- A comma separated list of page numbers or ranges.public Pdfcrowd.PdfToTextClient setNoLayout(boolean value)
value
- Set to true to ignore the layout.public Pdfcrowd.PdfToTextClient setEol(String eol)
eol
- Allowed values are unix, dos, mac.public Pdfcrowd.PdfToTextClient setPageBreakMode(String mode)
mode
- Allowed values are none, default, custom.public Pdfcrowd.PdfToTextClient setCustomPageBreak(String pageBreak)
pageBreak
- String to insert between the pages.public Pdfcrowd.PdfToTextClient setParagraphMode(String mode)
mode
- Allowed values are none, bounding-box, characters.public Pdfcrowd.PdfToTextClient setLineSpacingThreshold(String threshold)
threshold
- The value must be a positive integer percentage.public Pdfcrowd.PdfToTextClient setRemoveHyphenation(boolean value)
value
- Set to true to remove hyphens.public Pdfcrowd.PdfToTextClient setRemoveEmptyLines(boolean value)
value
- Set to true to remove empty lines.public Pdfcrowd.PdfToTextClient setCropAreaX(int x)
x
- Must be a positive integer number or 0.public Pdfcrowd.PdfToTextClient setCropAreaY(int y)
y
- Must be a positive integer number or 0.public Pdfcrowd.PdfToTextClient setCropAreaWidth(int width)
width
- Must be a positive integer number or 0.public Pdfcrowd.PdfToTextClient setCropAreaHeight(int height)
height
- Must be a positive integer number or 0.public Pdfcrowd.PdfToTextClient setCropArea(int x, int y, int width, int height)
x
- Set the top left X coordinate of the crop area in points. Must be a positive integer number or 0.y
- Set the top left Y coordinate of the crop area in points. Must be a positive integer number or 0.width
- Set the width of the crop area in points. Must be a positive integer number or 0.height
- Set the height of the crop area in points. Must be a positive integer number or 0.public Pdfcrowd.PdfToTextClient 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 getPageCount()
public int getOutputSize()
public String getVersion()
public Pdfcrowd.PdfToTextClient setTag(String tag)
tag
- A string with the custom tag.public Pdfcrowd.PdfToTextClient setHttpProxy(String proxy)
proxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.PdfToTextClient setHttpsProxy(String proxy)
proxy
- The value must have format DOMAIN_OR_IP_ADDRESS:PORT.public Pdfcrowd.PdfToTextClient setUseHttp(boolean value)
value
- Set to true to use HTTP.public Pdfcrowd.PdfToTextClient setUserAgent(String agent)
agent
- The user agent string.public Pdfcrowd.PdfToTextClient 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.PdfToTextClient setRetryCount(int count)
count
- Number of retries.Copyright © 2022. All rights reserved.