Skip to content
Merged
  •  
  •  
  •  
14 changes: 11 additions & 3 deletions Java/Complex Flow Examples/DecryptAddReencrypt.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

public class DecryptAddReencrypt {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your PDF file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -51,7 +59,7 @@ public static void main(String[] args) {
Request decryptRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/decrypted-pdf")
.url(API_URL + "/decrypted-pdf")
.post(decryptRequestBody)
.build();
try {
Expand Down Expand Up @@ -87,7 +95,7 @@ public static void main(String[] args) {
Request addImageRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf-with-added-image")
.url(API_URL + "/pdf-with-added-image")
.post(addImageRequestBody)
.build();
try {
Expand Down Expand Up @@ -119,7 +127,7 @@ public static void main(String[] args) {
Request encryptRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/encrypted-pdf")
.url(API_URL + "/encrypted-pdf")
.post(encryptRequestBody)
.build();
try {
Expand Down
14 changes: 11 additions & 3 deletions Java/Complex Flow Examples/MergeDifferentFileTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

public class MergeDifferentFileTypes {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your first file here, or as the first argument when running the program.
private static final String DEFAULT_FIRST_FILE_PATH = "/path/to/file.png";

Expand Down Expand Up @@ -53,7 +61,7 @@ public static void main(String[] args) {
Request firstFileRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf")
.url(API_URL + "/pdf")
.post(firstFileRequestBody)
.build();
try {
Expand Down Expand Up @@ -85,7 +93,7 @@ public static void main(String[] args) {
Request secondFileRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf")
.url(API_URL + "/pdf")
.post(secondFileRequestBody)
.build();
try {
Expand Down Expand Up @@ -121,7 +129,7 @@ public static void main(String[] args) {
Request mergeRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/merged-pdf")
.url(API_URL + "/merged-pdf")
.post(mergeRequestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Complex Flow Examples/OcrWithExtractText.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@

public class OcrWithExtractText {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your PDF file here, or as the first argument when running the program.
private static final String DEFAULT_PDF_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -44,7 +52,7 @@ public static void main(String[] args) {
Request ocrRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf-with-ocr-text")
.url(API_URL + "/pdf-with-ocr-text")
.post(ocrRequestBody)
.build();
try {
Expand Down Expand Up @@ -74,7 +82,7 @@ public static void main(String[] args) {
Request extractRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/extracted-text")
.url(API_URL + "/extracted-text")
.post(extractRequestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Complex Flow Examples/PDFA3bWithAttachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@

public class PDFA3bWithAttachment {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -54,7 +62,7 @@ public static void main(String[] args) {
Request attachmentRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf-with-added-attachment")
.url(API_URL + "/pdf-with-added-attachment")
.post(attachmentRequestBody)
.build();
try {
Expand Down Expand Up @@ -85,7 +93,7 @@ public static void main(String[] args) {
Request pdfaRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdfa")
.url(API_URL + "/pdfa")
.post(pdfaRequestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Complex Flow Examples/PreserveWordDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

public class PreserveWordDocument {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -42,7 +50,7 @@ public static void main(String[] args) {
Request pdfRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf")
.url(API_URL + "/pdf")
.post(pdfRequestBody)
.build();
try {
Expand Down Expand Up @@ -73,7 +81,7 @@ public static void main(String[] args) {
Request pdfaRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdfa")
.url(API_URL + "/pdfa")
.post(pdfaRequestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Complex Flow Examples/ProtectedWatermark.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

public class ProtectedWatermark {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -43,7 +51,7 @@ public static void main(String[] args) {
Request watermarkRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/watermarked-pdf")
.url(API_URL + "/watermarked-pdf")
.post(watermarkRequestBody)
.build();
try {
Expand Down Expand Up @@ -77,7 +85,7 @@ public static void main(String[] args) {
Request restrictRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/restricted-pdf")
.url(API_URL + "/restricted-pdf")
.post(restrictRequestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Complex Flow Examples/RedactPreviewAndFinalize.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@

public class RedactPreviewAndFinalize {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file";

Expand Down Expand Up @@ -47,7 +55,7 @@ public static void main(String[] args) {
Request previewRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf-with-redacted-text-preview")
.url(API_URL + "/pdf-with-redacted-text-preview")
.post(previewRequestBody)
.build();
try {
Expand Down Expand Up @@ -77,7 +85,7 @@ public static void main(String[] args) {
Request appliedRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/pdf-with-redacted-text-applied")
.url(API_URL + "/pdf-with-redacted-text-applied")
.post(appliedRequestBody)
.build();
try {
Expand Down
10 changes: 9 additions & 1 deletion Java/Endpoint Examples/JSON Payload/BatchDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

public class BatchDelete {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static String API_URL = "https://eu-api.pdfrest.com"

// Specify your API key here, or in the environment variable PDFREST_API_KEY.
// You can also put the environment variable in a .env file.
private static final String DEFAULT_API_KEY = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
Expand All @@ -23,7 +31,7 @@ public static void main(String[] args) {
Request request =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/delete")
.url(API_URL + "/delete")
.post(requestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Endpoint Examples/JSON Payload/Bmp.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

public class Bmp {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -44,7 +52,7 @@ public static void main(String[] args) {
Request request =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/bmp")
.url(API_URL + "/bmp")
.post(requestBody)
.build();
try {
Expand Down Expand Up @@ -78,7 +86,7 @@ private static String uploadFile(File inputFile) {
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.header("Content-Filename", "File.pdf")
.url("https://api.pdfrest.com/upload")
.url(API_URL + "/upload")
.post(requestBody)
.build();
try {
Expand Down
12 changes: 10 additions & 2 deletions Java/Endpoint Examples/JSON Payload/CompressedPDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

public class CompressedPDF {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -45,7 +53,7 @@ public static void main(String[] args) {
Request request =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/compressed-pdf")
.url(API_URL + "/compressed-pdf")
.post(requestBody)
.build();
try {
Expand Down Expand Up @@ -79,7 +87,7 @@ private static String uploadFile(File inputFile) {
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.header("Content-Filename", "File.pdf")
.url("https://api.pdfrest.com/upload")
.url(API_URL + "/upload")
.post(requestBody)
.build();
try {
Expand Down
14 changes: 11 additions & 3 deletions Java/Endpoint Examples/JSON Payload/DecryptedPDF.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

public class DecryptedPDF {

// By default, we use the US-based API service. This is the primary endpoint for global use.
private static final String API_URL = "https://api.pdfrest.com";

// For GDPR compliance and enhanced performance for European users, you can switch to the EU-based
// service by commenting out the URL above and uncommenting the URL below.
// For more information visit https://pdfrest.com/pricing#how-do-eu-gdpr-api-calls-work
// private static final String API_URL = "https://eu-api.pdfrest.com";

// Specify the path to your file here, or as the first argument when running the program.
private static final String DEFAULT_FILE_PATH = "/path/to/file.pdf";

Expand Down Expand Up @@ -46,7 +54,7 @@ public static void main(String[] args) {
Request request =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/decrypted-pdf")
.url(API_URL + "/decrypted-pdf")
.post(requestBody)
.build();
try {
Expand Down Expand Up @@ -76,7 +84,7 @@ public static void main(String[] args) {
Request deleteRequest =
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.url("https://api.pdfrest.com/delete")
.url(API_URL + "/delete")
.post(deleteBody)
.build();
try (Response deleteResp =
Expand Down Expand Up @@ -114,7 +122,7 @@ private static String uploadFile(File inputFile) {
new Request.Builder()
.header("Api-Key", dotenv.get("PDFREST_API_KEY", DEFAULT_API_KEY))
.header("Content-Filename", "File.pdf")
.url("https://api.pdfrest.com/upload")
.url(API_URL + "/upload")
.post(requestBody)
.build();
try {
Expand Down
Loading