Class PdfGate
Provides synchronous and asynchronous helpers for each endpoint, plus call builders
for custom execution. Non-2xx responses are surfaced as PdfGateException with
status code and response body details.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a client with the default configuration.PdfGate(String apiKey, PdfGateConfig config) Creates a client with a custom configuration. -
Method Summary
Modifier and TypeMethodDescriptioncompressPdf(CompressPdfParams params) Compresses a PDF and returns a JSON document response.compressPdfAsync(CompressPdfParams params) Compresses a PDF asynchronously and returns a JSON document response.compressPdfCall(CompressPdfParams params) Builds a call that expects a JSON document response.createEnvelope(CreateEnvelopeParams params) Creates an envelope and returns the envelope metadata response.Creates an envelope asynchronously and returns the envelope metadata response.Builds a call that expects an envelope JSON response.voidenqueue(CallEnvelope call, PdfGateCallback<PDFGateEnvelope> callback) Enqueues a JSON response call and maps the response toPDFGateEnvelope.voidenqueue(CallFile call, PdfGateCallback<byte[]> callback) Enqueues a bytes response call and returns the raw response bytes.voidenqueue(CallJsonObject call, PdfGateCallback<com.google.gson.JsonObject> callback) Enqueues a JSON response call and maps the response toJsonObject.voidenqueue(CallJson call, PdfGateCallback<PdfGateDocument> callback) Enqueues a JSON response call and maps the response toPdfGateDocument.com.google.gson.JsonObjectExtracts PDF form field data and returns the JSON response.CompletableFuture<com.google.gson.JsonObject> Extracts PDF form field data asynchronously and returns the JSON response.Builds a call that expects a JSON response containing form field data.flattenPdf(FlattenPdfParams params) Flattens a PDF and returns a JSON document response.flattenPdfAsync(FlattenPdfParams params) Flattens a PDF asynchronously and returns a JSON document response.flattenPdfCall(FlattenPdfParams params) Builds a call that expects a JSON document response.generatePdf(GeneratePdfParams params) Generates a PDF from HTML or a URL and returns a JSON document response.generatePdfAsync(GeneratePdfParams params) Generates a PDF from HTML or a URL asynchronously and returns a JSON document response.generatePdfCall(GeneratePdfParams params) Builds a call that expects a JSON document response.getDocument(GetDocumentParams params) Retrieves document metadata (and optionally a fresh pre-signed URL).getDocumentAsync(GetDocumentParams params) Retrieves document metadata asynchronously.getDocumentCall(GetDocumentParams params) Builds a call that expects a JSON document response.getEnvelope(GetEnvelopeParams params) Retrieves an envelope and returns the envelope metadata response.getEnvelopeAsync(GetEnvelopeParams params) Retrieves an envelope asynchronously and returns the envelope metadata response.getEnvelopeCall(GetEnvelopeParams params) Builds a call that expects an envelope JSON response.byte[]getFile(GetFileParams params) Retrieves a stored document file.CompletableFuture<byte[]> getFileAsync(GetFileParams params) Retrieves a stored document file asynchronously.getFileCall(GetFileParams params) Builds a call that expects a raw bytes response.protectPdf(ProtectPdfParams params) Protects a PDF and returns a JSON document response.protectPdfAsync(ProtectPdfParams params) Protects a PDF asynchronously and returns a JSON document response.protectPdfCall(ProtectPdfParams params) Builds a call that expects a JSON document response.sendEnvelope(SendEnvelopeParams params) Sends an envelope and returns the updated envelope metadata response.sendEnvelopeAsync(SendEnvelopeParams params) Sends an envelope asynchronously and returns the updated envelope metadata response.sendEnvelopeCall(SendEnvelopeParams params) Builds a call that expects an envelope JSON response.uploadFile(UploadFileParams params) Uploads a PDF file passing the file or through a URL pointing to the file and returns a JSON document response.uploadFileAsync(UploadFileParams params) Uploads a PDF file passing the file or through a URL pointing to the file and returns a JSON document response.uploadFileCall(UploadFileParams params) Builds a call that expects a JSON document response.watermarkPdf(WatermarkPdfParams params) Applies a watermark to a PDF and returns a JSON document response.watermarkPdfAsync(WatermarkPdfParams params) Applies a watermark to a PDF asynchronously and returns a JSON document response.watermarkPdfCall(WatermarkPdfParams params) Builds a call that expects a JSON document response.
-
Constructor Details
-
PdfGate
Creates a client with the default configuration.- Parameters:
apiKey- API key used for authentication.
-
PdfGate
Creates a client with a custom configuration.- Parameters:
apiKey- API key used for authentication.config- configuration for API domains and timeouts.
-
-
Method Details
-
generatePdf
Generates a PDF from HTML or a URL and returns a JSON document response.- Parameters:
params- parameters for the generate PDF request.- Returns:
- the generated document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
generatePdfAsync
Generates a PDF from HTML or a URL asynchronously and returns a JSON document response.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the generate PDF request.- Returns:
- a future that completes with the generated document metadata.
-
generatePdfCall
Builds a call that expects a JSON document response.- Parameters:
params- parameters for the generate PDF request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
flattenPdf
Flattens a PDF and returns a JSON document response.This SDK currently supports flattening by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the flatten PDF request.- Returns:
- the flattened document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
flattenPdfAsync
Flattens a PDF asynchronously and returns a JSON document response.This SDK currently supports flattening by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the flatten PDF request.- Returns:
- a future that completes with the flattened document metadata.
-
flattenPdfCall
Builds a call that expects a JSON document response.This SDK currently supports flattening by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the flatten PDF request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
protectPdf
Protects a PDF and returns a JSON document response.This SDK currently supports protecting by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the protect PDF request.- Returns:
- the protected document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
protectPdfAsync
Protects a PDF asynchronously and returns a JSON document response.This SDK currently supports protecting by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the protect PDF request.- Returns:
- a future that completes with the protected document metadata.
-
protectPdfCall
Builds a call that expects a JSON document response.This SDK currently supports protecting by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the protect PDF request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
compressPdf
Compresses a PDF and returns a JSON document response.This SDK currently supports compressing by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the compress PDF request.- Returns:
- the compressed document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
compressPdfAsync
Compresses a PDF asynchronously and returns a JSON document response.This SDK currently supports compressing by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the compress PDF request.- Returns:
- a future that completes with the compressed document metadata.
-
compressPdfCall
Builds a call that expects a JSON document response.This SDK currently supports compressing by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the compress PDF request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
watermarkPdf
Applies a watermark to a PDF and returns a JSON document response.This SDK currently supports watermarking by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the watermark PDF request.- Returns:
- the watermarked document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
watermarkPdfAsync
Applies a watermark to a PDF asynchronously and returns a JSON document response.This SDK currently supports watermarking by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the watermark PDF request.- Returns:
- a future that completes with the watermarked document metadata.
-
watermarkPdfCall
Builds a call that expects a JSON document response.This SDK currently supports watermarking by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the watermark PDF request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
createEnvelope
Creates an envelope and returns the envelope metadata response.- Parameters:
params- parameters for the create envelope request.- Returns:
- the created envelope metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
createEnvelopeAsync
Creates an envelope asynchronously and returns the envelope metadata response.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the create envelope request.- Returns:
- a future that completes with the created envelope metadata.
-
createEnvelopeCall
Builds a call that expects an envelope JSON response.- Parameters:
params- parameters for the create envelope request.- Returns:
- a call that yields a
PDFGateEnveloperesponse.
-
sendEnvelope
Sends an envelope and returns the updated envelope metadata response.- Parameters:
params- parameters for the send envelope request.- Returns:
- the updated envelope metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
sendEnvelopeAsync
Sends an envelope asynchronously and returns the updated envelope metadata response.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the send envelope request.- Returns:
- a future that completes with the updated envelope metadata.
-
sendEnvelopeCall
Builds a call that expects an envelope JSON response.- Parameters:
params- parameters for the send envelope request.- Returns:
- a call that yields a
PDFGateEnveloperesponse.
-
getEnvelope
Retrieves an envelope and returns the envelope metadata response.- Parameters:
params- parameters for the get envelope request.- Returns:
- the envelope metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
getEnvelopeAsync
Retrieves an envelope asynchronously and returns the envelope metadata response.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the get envelope request.- Returns:
- a future that completes with the envelope metadata.
-
getEnvelopeCall
Builds a call that expects an envelope JSON response.- Parameters:
params- parameters for the get envelope request.- Returns:
- a call that yields a
PDFGateEnveloperesponse.
-
extractPdfFormData
public com.google.gson.JsonObject extractPdfFormData(ExtractPdfFormDataParams params) throws IOException Extracts PDF form field data and returns the JSON response.This SDK currently supports extraction by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the extract form data request.- Returns:
- the JSON response containing form field data.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
extractPdfFormDataAsync
public CompletableFuture<com.google.gson.JsonObject> extractPdfFormDataAsync(ExtractPdfFormDataParams params) Extracts PDF form field data asynchronously and returns the JSON response.This SDK currently supports extraction by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the extract form data request.- Returns:
- a future that completes with the JSON form data response.
-
extractPdfFormDataCall
Builds a call that expects a JSON response containing form field data.This SDK currently supports extraction by
documentIdonly. To upload a file directly, useuploadFile(UploadFileParams)first and pass the resulting document ID.- Parameters:
params- parameters for the extract form data request.- Returns:
- a call that yields JSON form field data.
-
getDocument
Retrieves document metadata (and optionally a fresh pre-signed URL).- Parameters:
params- parameters for the get document request.- Returns:
- the document metadata response.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
getDocumentAsync
Retrieves document metadata asynchronously.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the get document request.- Returns:
- a future that completes with the document metadata.
-
getDocumentCall
Builds a call that expects a JSON document response.- Parameters:
params- parameters for the get document request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
getFile
Retrieves a stored document file.Accessing stored files requires enabling "Save files" in the PDFGate Dashboard settings.
- Parameters:
params- parameters for the get file request.- Returns:
- the stored PDF bytes.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
getFileAsync
Retrieves a stored document file asynchronously.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the get file request.- Returns:
- a future that completes with the stored PDF bytes.
-
getFileCall
Builds a call that expects a raw bytes response.- Parameters:
params- parameters for the get file request.- Returns:
- a call that yields raw PDF bytes.
-
uploadFile
Uploads a PDF file passing the file or through a URL pointing to the file and returns a JSON document response.- Parameters:
params- parameters for the upload file request.- Returns:
- the uploaded document metadata.
- Throws:
PdfGateException- when the request fails or the API returns a non-2xx response.IOException
-
uploadFileAsync
Uploads a PDF file passing the file or through a URL pointing to the file and returns a JSON document response.The returned future completes exceptionally with
PdfGateExceptionon errors.- Parameters:
params- parameters for the upload file request.- Returns:
- a future that completes with the uploaded document metadata.
-
uploadFileCall
Builds a call that expects a JSON document response.- Parameters:
params- parameters for the upload file request.- Returns:
- a call that yields a
PdfGateDocumentresponse.
-
enqueue
Enqueues a JSON response call and maps the response toPdfGateDocument.- Parameters:
call- the call to enqueue.callback- the callback for the response.
-
enqueue
Enqueues a bytes response call and returns the raw response bytes.- Parameters:
call- the call to enqueue.callback- the callback for the response.
-
enqueue
Enqueues a JSON response call and maps the response toJsonObject.- Parameters:
call- the call to enqueue.callback- the callback for the response.
-
enqueue
Enqueues a JSON response call and maps the response toPDFGateEnvelope.- Parameters:
call- the call to enqueue.callback- the callback for the response.
-