diff --git a/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs b/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs index b942f78..98ddc72 100644 --- a/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs +++ b/DotNET/Complex Flow Examples/decrypt-add-reencrypt.cs @@ -10,11 +10,13 @@ * lock it up again. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Your API key here + using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { using (var decryptRequest = new HttpRequestMessage(HttpMethod.Post, "decrypted-pdf")) { - decryptRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); + decryptRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); decryptRequest.Headers.Accept.Add(new("application/json")); var decryptMultipartContent = new MultipartFormDataContent(); @@ -41,7 +43,7 @@ using (var addImageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-image")) { - addImageRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); + addImageRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); addImageRequest.Headers.Accept.Add(new("application/json")); var addImageMultipartContent = new MultipartFormDataContent(); @@ -74,7 +76,7 @@ using (var encryptRequest = new HttpRequestMessage(HttpMethod.Post, "encrypted-pdf")) { - encryptRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); + encryptRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); encryptRequest.Headers.Accept.Add(new("application/json")); var multipartContent = new MultipartFormDataContent(); diff --git a/DotNET/Complex Flow Examples/merge-different-file-types.cs b/DotNET/Complex Flow Examples/merge-different-file-types.cs index 21cb69a..f229659 100644 --- a/DotNET/Complex Flow Examples/merge-different-file-types.cs +++ b/DotNET/Complex Flow Examples/merge-different-file-types.cs @@ -13,11 +13,13 @@ * that the /pdf route takes as inputs. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Your API key here + using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { using (var imageRequest = new HttpRequestMessage(HttpMethod.Post, "pdf")) { - imageRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + imageRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); imageRequest.Headers.Accept.Add(new("application/json")); var imageMultipartContent = new MultipartFormDataContent(); @@ -38,7 +40,7 @@ using (var powerpointRequest = new HttpRequestMessage(HttpMethod.Post, "pdf")) { - powerpointRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + powerpointRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); powerpointRequest.Headers.Accept.Add(new("application/json")); var powerpointMultipartContent = new MultipartFormDataContent(); @@ -59,7 +61,7 @@ using (var request = new HttpRequestMessage(HttpMethod.Post, "merged-pdf")) { - request.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); + request.Headers.TryAddWithoutValidation("Api-Key", apiKey); request.Headers.Accept.Add(new("application/json")); var multipartContent = new MultipartFormDataContent(); diff --git a/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs b/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs index e44b715..5f0be31 100644 --- a/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs +++ b/DotNET/Complex Flow Examples/pdfa-3b-with-attachment.cs @@ -11,11 +11,13 @@ * file may be attached and wrapped into the PDF/A conversion. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Your API key here + using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { using (var attachRequest = new HttpRequestMessage(HttpMethod.Post, "pdf-with-added-attachment")) { - attachRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + attachRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); attachRequest.Headers.Accept.Add(new("application/json")); var attachMultipartContent = new MultipartFormDataContent(); @@ -27,7 +29,7 @@ var byteArray2 = File.ReadAllBytes("/path/to/file.xml"); var byteAryContent2 = new ByteArrayContent(byteArray2); attachMultipartContent.Add(byteAryContent2, "file_to_attach", "file_name.xml"); - byteAryContent2.Headers.TryAddWithoutValidation("Content-Type", "application/xml"); // Update content type + byteAryContent2.Headers.TryAddWithoutValidation("Content-Type", "application/xml"); attachRequest.Content = attachMultipartContent; var attachResponse = await httpClient.SendAsync(attachRequest); @@ -41,7 +43,7 @@ using (var request = new HttpRequestMessage(HttpMethod.Post, "pdfa")) { - request.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + request.Headers.TryAddWithoutValidation("Api-Key", apiKey); request.Headers.Accept.Add(new("application/json")); var multipartContent = new MultipartFormDataContent(); diff --git a/DotNET/Complex Flow Examples/preserve-word-document.cs b/DotNET/Complex Flow Examples/preserve-word-document.cs index f79e87e..d10a11a 100644 --- a/DotNET/Complex Flow Examples/preserve-word-document.cs +++ b/DotNET/Complex Flow Examples/preserve-word-document.cs @@ -8,11 +8,13 @@ * and convert it to the PDF/A format for long-term storage. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Your API key here + using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { using (var pdfRequest = new HttpRequestMessage(HttpMethod.Post, "pdf")) { - pdfRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + pdfRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); pdfRequest.Headers.Accept.Add(new("application/json")); var pdfMultipartContent = new MultipartFormDataContent(); @@ -33,7 +35,7 @@ using (var request = new HttpRequestMessage(HttpMethod.Post, "pdfa")) { - request.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + request.Headers.TryAddWithoutValidation("Api-Key", apiKey); request.Headers.Accept.Add(new("application/json")); var multipartContent = new MultipartFormDataContent(); diff --git a/DotNET/Complex Flow Examples/protected-watermark.cs b/DotNET/Complex Flow Examples/protected-watermark.cs index 65c9f2d..855fd11 100644 --- a/DotNET/Complex Flow Examples/protected-watermark.cs +++ b/DotNET/Complex Flow Examples/protected-watermark.cs @@ -9,11 +9,13 @@ * and then /restricted-pdf to lock the watermark in. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Your API key here + using (var httpClient = new HttpClient { BaseAddress = new Uri("https://api.pdfrest.com") }) { using (var watermarkRequest = new HttpRequestMessage(HttpMethod.Post, "watermarked-pdf")) { - watermarkRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + watermarkRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); watermarkRequest.Headers.Accept.Add(new("application/json")); var watermarkMultipartContent = new MultipartFormDataContent(); @@ -37,7 +39,7 @@ using (var restrictRequest = new HttpRequestMessage(HttpMethod.Post, "restricted-pdf")) { - restrictRequest.Headers.TryAddWithoutValidation("Api-Key", "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"); // Your API key here + restrictRequest.Headers.TryAddWithoutValidation("Api-Key", apiKey); restrictRequest.Headers.Accept.Add(new("application/json")); var restrictMultipartContent = new MultipartFormDataContent(); diff --git a/JavaScript/Complex Flow Examples/decrypt-add-reencrypt.js b/JavaScript/Complex Flow Examples/decrypt-add-reencrypt.js index d54145b..b77fc9b 100644 --- a/JavaScript/Complex Flow Examples/decrypt-add-reencrypt.js +++ b/JavaScript/Complex Flow Examples/decrypt-add-reencrypt.js @@ -11,6 +11,8 @@ var fs = require("fs"); * lock it up again. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Replace with your API key + var decryptRequestData = new FormData(); decryptRequestData.append("file", fs.createReadStream("/path/to/file.pdf")); decryptRequestData.append("current_open_password", "current_example_pw"); @@ -20,7 +22,7 @@ var decryptConfig = { maxBodyLength: Infinity, url: "https://api.pdfrest.com/decrypted-pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...decryptRequestData.getHeaders(), }, data: decryptRequestData, @@ -41,7 +43,7 @@ axios(decryptConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdf-with-added-image", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...data.getHeaders(), }, data: data, @@ -58,7 +60,7 @@ axios(decryptConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/encrypted-pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...data.getHeaders(), }, data: data, diff --git a/JavaScript/Complex Flow Examples/merge-different-file-types.js b/JavaScript/Complex Flow Examples/merge-different-file-types.js index bd963ed..6c066cc 100644 --- a/JavaScript/Complex Flow Examples/merge-different-file-types.js +++ b/JavaScript/Complex Flow Examples/merge-different-file-types.js @@ -14,6 +14,8 @@ First, we will upload an image file to the /pdf route and capture the output ID. * that the /pdf route takes as inputs. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Replace with your API key + var imageData = new FormData(); imageData.append("file", fs.createReadStream("/path/to/image.png")); @@ -22,7 +24,7 @@ var imageConfig = { maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...imageData.getHeaders(), }, data: imageData, @@ -40,7 +42,7 @@ axios(imageConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...pptData.getHeaders(), }, data: pptData, @@ -64,7 +66,7 @@ axios(imageConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/merged-pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...mergeData.getHeaders(), }, data: mergeData, diff --git a/JavaScript/Complex Flow Examples/pdfa-3b-with-attachment.js b/JavaScript/Complex Flow Examples/pdfa-3b-with-attachment.js index 603c71e..fc06fe4 100644 --- a/JavaScript/Complex Flow Examples/pdfa-3b-with-attachment.js +++ b/JavaScript/Complex Flow Examples/pdfa-3b-with-attachment.js @@ -12,6 +12,8 @@ var fs = require("fs"); * file may be attached and wrapped into the PDF/A conversion. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Replace with your API key + var attachData = new FormData(); attachData.append("file", fs.createReadStream("/path/to/file.pdf")); attachData.append( @@ -25,7 +27,7 @@ var attachConfig = { maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdf-with-added-attachment", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...attachData.getHeaders(), }, data: attachData, @@ -45,7 +47,7 @@ axios(attachConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdfa", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...pdfaData.getHeaders(), }, data: pdfaData, diff --git a/JavaScript/Complex Flow Examples/preserve-word-document.js b/JavaScript/Complex Flow Examples/preserve-word-document.js index 23304d9..39ac600 100644 --- a/JavaScript/Complex Flow Examples/preserve-word-document.js +++ b/JavaScript/Complex Flow Examples/preserve-word-document.js @@ -9,6 +9,8 @@ var fs = require("fs"); * and convert it to the PDF/A format for long-term storage. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Replace with your API key + var pdfData = new FormData(); pdfData.append("file", fs.createReadStream("/path/to/word.doc")); @@ -17,7 +19,7 @@ var pdfConfig = { maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...pdfData.getHeaders(), }, data: pdfData, @@ -37,7 +39,7 @@ axios(pdfConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/pdfa", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...pdfaData.getHeaders(), }, data: pdfaData, diff --git a/JavaScript/Complex Flow Examples/protected-watermark.js b/JavaScript/Complex Flow Examples/protected-watermark.js index e38eeef..41bcef2 100644 --- a/JavaScript/Complex Flow Examples/protected-watermark.js +++ b/JavaScript/Complex Flow Examples/protected-watermark.js @@ -9,6 +9,8 @@ var fs = require("fs"); * and then /restricted-pdf to lock the watermark in. */ +var apiKey = "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // Replace with your API key + var watermarkData = new FormData(); watermarkData.append("file", fs.createReadStream("/path/to/file.pdf")); watermarkData.append("watermark_text", "Watermarked"); @@ -18,7 +20,7 @@ var watermarkConfig = { maxBodyLength: Infinity, url: "https://api.pdfrest.com/watermarked-pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...watermarkData.getHeaders(), }, data: watermarkData, @@ -40,7 +42,7 @@ axios(watermarkConfig) maxBodyLength: Infinity, url: "https://api.pdfrest.com/restricted-pdf", headers: { - "Api-Key": "xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", // Replace with your API key + "Api-Key": apiKey, ...data.getHeaders(), }, data: data, diff --git a/Python/Complex Flow Examples/decrypt-add-reencrypt.py b/Python/Complex Flow Examples/decrypt-add-reencrypt.py index 315a508..324ceb1 100644 --- a/Python/Complex Flow Examples/decrypt-add-reencrypt.py +++ b/Python/Complex Flow Examples/decrypt-add-reencrypt.py @@ -10,6 +10,8 @@ # and then sending the output with the new image through /encrypted-pdf to # lock it up again. +api_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + decrypted_pdf_endpoint_url = 'https://api.pdfrest.com/decrypted-pdf' mp_encoder_decryptedPdf = MultipartEncoder( @@ -22,7 +24,7 @@ decrypt_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_decryptedPdf.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to decrypted-pdf endpoint...") @@ -50,7 +52,7 @@ add_image_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_pdfWithAddedImage.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdf-with-added-image endpoint...") @@ -75,7 +77,7 @@ encrypt_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_encryptedPdf.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to encrypted-pdf endpoint...") diff --git a/Python/Complex Flow Examples/merge-different-file-types.py b/Python/Complex Flow Examples/merge-different-file-types.py index 5cf773d..1dd98f2 100644 --- a/Python/Complex Flow Examples/merge-different-file-types.py +++ b/Python/Complex Flow Examples/merge-different-file-types.py @@ -14,6 +14,8 @@ # this sample could be easily used to convert and combine any two file types # that the /pdf route takes as inputs. +api_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + pdf_endpoint_url = 'https://api.pdfrest.com/pdf' mp_encoder_image_pdf = MultipartEncoder( fields={ @@ -24,7 +26,7 @@ image_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_image_pdf.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdf endpoint...") @@ -49,7 +51,7 @@ ppt_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_ppt_pdf.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdf endpoint...") @@ -73,7 +75,7 @@ merge_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_merge.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to merged-pdf endpoint...") diff --git a/Python/Complex Flow Examples/pdfa-3b-with-attachment.py b/Python/Complex Flow Examples/pdfa-3b-with-attachment.py index 5d7dd4f..c9dcc6c 100644 --- a/Python/Complex Flow Examples/pdfa-3b-with-attachment.py +++ b/Python/Complex Flow Examples/pdfa-3b-with-attachment.py @@ -11,6 +11,8 @@ # Note that there is nothing special about attaching an xml file, and any appropriate # file may be attached and wrapped into the PDF/A conversion. +api_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + pdf_with_added_attachment_endpoint_url = 'https://api.pdfrest.com/pdf-with-added-attachment' mp_encoder_pdfWithAddedAttachment = MultipartEncoder( @@ -24,7 +26,7 @@ attachment_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_pdfWithAddedAttachment.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdf-with-added-attachment endpoint...") @@ -50,7 +52,7 @@ headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_pdfa.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdfa endpoint...") diff --git a/Python/Complex Flow Examples/preserve-word-document.py b/Python/Complex Flow Examples/preserve-word-document.py index 0796d0a..541af59 100644 --- a/Python/Complex Flow Examples/preserve-word-document.py +++ b/Python/Complex Flow Examples/preserve-word-document.py @@ -8,6 +8,7 @@ # a PDF with a call to the /pdf route. Then, we will take that converted PDF # and convert it to the PDF/A format for long-term storage. +api_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here pdf_endpoint_url = 'https://api.pdfrest.com/pdf' @@ -20,7 +21,7 @@ pdf_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_pdf.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdf endpoint...") @@ -47,7 +48,7 @@ headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_pdfa.content_type, - 'Api-Key': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to pdfa endpoint...") diff --git a/Python/Complex Flow Examples/protected-watermark.py b/Python/Complex Flow Examples/protected-watermark.py index 0291dfe..fd058b5 100644 --- a/Python/Complex Flow Examples/protected-watermark.py +++ b/Python/Complex Flow Examples/protected-watermark.py @@ -9,6 +9,8 @@ # We will be running the input file through /watermarked-pdf to apply the watermark # and then /restricted-pdf to lock the watermark in. +api_key = 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + watermarked_pdf_endpoint_url = 'https://api.pdfrest.com/watermarked-pdf' mp_encoder_watermarkedPDF = MultipartEncoder( @@ -21,7 +23,7 @@ watermark_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_watermarkedPDF.content_type, - 'Api-Key': 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to watermarked-pdf endpoint...") @@ -50,7 +52,7 @@ restrict_headers = { 'Accept': 'application/json', 'Content-Type': mp_encoder_restrictedPdf.content_type, - 'Api-Key': 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' # place your api key here + 'Api-Key': api_key } print("Sending POST request to restricted-pdf endpoint...") diff --git a/cURL/Complex Flow Examples/decrypt-add-reencrypt.sh b/cURL/Complex Flow Examples/decrypt-add-reencrypt.sh index f48684a..0a69f0c 100755 --- a/cURL/Complex Flow Examples/decrypt-add-reencrypt.sh +++ b/cURL/Complex Flow Examples/decrypt-add-reencrypt.sh @@ -8,10 +8,12 @@ # and then sending the output with the new image through /encrypted-pdf to # lock it up again. +API_KEY="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # place your api key here + DECRYPTED_ID=$(curl -X POST "https://api.pdfrest.com/decrypted-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/file.pdf" \ -F "output=example_out" \ -F "current_open_password=password" \ @@ -21,7 +23,7 @@ DECRYPTED_ID=$(curl -X POST "https://api.pdfrest.com/decrypted-pdf" \ ADDED_IMAGE_ID=$(curl -X POST "https://api.pdfrest.com/pdf-with-added-image" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$DECRYPTED_ID" \ -F "image_file=@/path/to/image.png" \ -F "output=example_out" \ @@ -34,7 +36,7 @@ ADDED_IMAGE_ID=$(curl -X POST "https://api.pdfrest.com/pdf-with-added-image" \ curl -X POST "https://api.pdfrest.com/encrypted-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$ADDED_IMAGE_ID" \ -F "output=example_out" \ -F "new_open_password=password" diff --git a/cURL/Complex Flow Examples/merge-different-file-types.sh b/cURL/Complex Flow Examples/merge-different-file-types.sh index f68633c..cf62cf6 100755 --- a/cURL/Complex Flow Examples/merge-different-file-types.sh +++ b/cURL/Complex Flow Examples/merge-different-file-types.sh @@ -11,10 +11,12 @@ # this sample could be easily used to convert and combine any two file types # that the /pdf route takes as inputs. +API_KEY="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # place your api key here + IMAGE_ID=$(curl -X POST "https://api.pdfrest.com/pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/file.png" \ -F "output=example_out" \ | jq -r '.outputId') @@ -23,7 +25,7 @@ IMAGE_ID=$(curl -X POST "https://api.pdfrest.com/pdf" \ PPT_ID=$(curl -X POST "https://api.pdfrest.com/pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/powerpoint.ppt" \ -F "output=example_out" \ | jq -r '.outputId') @@ -32,7 +34,7 @@ PPT_ID=$(curl -X POST "https://api.pdfrest.com/pdf" \ curl -X POST "https://api.pdfrest.com/merged-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$IMAGE_ID" \ -F "pages[]=all" -F "type[]=id" \ -F "id=$PPT_ID" \ diff --git a/cURL/Complex Flow Examples/pdfa-3b-with-attachment.sh b/cURL/Complex Flow Examples/pdfa-3b-with-attachment.sh index 00482a6..11c9ccf 100755 --- a/cURL/Complex Flow Examples/pdfa-3b-with-attachment.sh +++ b/cURL/Complex Flow Examples/pdfa-3b-with-attachment.sh @@ -9,10 +9,12 @@ # Note that there is nothing special about attaching an xml file, and any appropriate # file may be attached and wrapped into the PDF/A conversion. +API_KEY="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # place your api key here + ATTACHED_ID=$(curl -X POST "https://api.pdfrest.com/pdf-with-added-attachment" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/file.pdf" \ -F "file_to_attach=@/path/to/file_to_attach.xml" \ -F "output=example_out" \ @@ -21,7 +23,7 @@ ATTACHED_ID=$(curl -X POST "https://api.pdfrest.com/pdf-with-added-attachment" \ curl -X POST "https://api.pdfrest.com/pdfa" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$ATTACHED_ID" \ -F "output=example_out" \ -F "output_type=PDF/A-3b" \ diff --git a/cURL/Complex Flow Examples/preserve-word-document.sh b/cURL/Complex Flow Examples/preserve-word-document.sh index e25b048..801e9d6 100755 --- a/cURL/Complex Flow Examples/preserve-word-document.sh +++ b/cURL/Complex Flow Examples/preserve-word-document.sh @@ -6,17 +6,19 @@ # a PDF with a call to the /pdf route. Then, we will take that converted PDF # and convert it to the PDF/A format for long-term storage. +API_KEY="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # place your api key here + PDF_ID=$(curl -X POST "https://api.pdfrest.com/pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/file.doc" \ | jq -r '.outputId') curl -X POST "https://api.pdfrest.com/pdfa" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$PDF_ID" \ -F "output=example_out" \ -F "output_type=PDF/A-3b" \ diff --git a/cURL/Complex Flow Examples/protected-watermark.sh b/cURL/Complex Flow Examples/protected-watermark.sh index f5d5e8b..f115d79 100755 --- a/cURL/Complex Flow Examples/protected-watermark.sh +++ b/cURL/Complex Flow Examples/protected-watermark.sh @@ -6,10 +6,13 @@ # We will be running the input file through /watermarked-pdf to apply the watermark # and then /restricted-pdf to lock the watermark in. + +API_KEY="xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" # place your api key here + WATERMARKED_ID=$(curl -X POST "https://api.pdfrest.com/watermarked-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "file=@/path/to/file.pdf" \ -F "watermark_text=watermark" \ -F "output=example_out" \ @@ -18,7 +21,7 @@ WATERMARKED_ID=$(curl -X POST "https://api.pdfrest.com/watermarked-pdf" \ curl -X POST "https://api.pdfrest.com/restricted-pdf" \ -H "Accept: application/json" \ -H "Content-Type: multipart/form-data" \ - -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \ + -H "Api-Key: $API_KEY" \ -F "id=$WATERMARKED_ID" \ -F "output=example_out" \ -F "restrictions[]=edit_annotations" \