diff --git a/JavaScript/Endpoint Examples/Multipart Payload/linearized-pdf.js b/JavaScript/Endpoint Examples/Multipart Payload/linearized-pdf.js index fc8d24f..ddd4e37 100644 --- a/JavaScript/Endpoint Examples/Multipart Payload/linearized-pdf.js +++ b/JavaScript/Endpoint Examples/Multipart Payload/linearized-pdf.js @@ -1,7 +1,7 @@ -// This request demonstrates how to flatten transparencies in a PDF. var axios = require('axios'); var FormData = require('form-data'); var fs = require('fs'); +// This request demonstrates how to liearize a PDF for fast web viewing. // Create a new form data instance and append the PDF file and parameters to it var data = new FormData(); diff --git a/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-attachment.js b/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-attachment.js index 438b8a3..6b1e358 100644 --- a/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-attachment.js +++ b/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-attachment.js @@ -1,6 +1,5 @@ /** - * This request demonstrates how to apply a file watermark to a PDF. This kind of watermark uses another PDF (using either watermark_file or watermark_file_id as a form-data parameter) and applies it as a watermark to the primary input document (file or id). - * Horizontal and vertical offsets of the watermark are measured in PDF units. (1 inch = 72 PDF units) + * This request demonstrates how to add a file attachment to a PDF. */ var axios = require('axios'); var FormData = require('form-data'); diff --git a/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-image.js b/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-image.js index 4642fce..e0a8c3f 100644 --- a/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-image.js +++ b/JavaScript/Endpoint Examples/Multipart Payload/pdf-with-added-image.js @@ -1,6 +1,5 @@ /** - * This request demonstrates how to apply a file watermark to a PDF. This kind of watermark uses another PDF (using either watermark_file or watermark_file_id as a form-data parameter) and applies it as a watermark to the primary input document (file or id). - * Horizontal and vertical offsets of the watermark are measured in PDF units. (1 inch = 72 PDF units) + * This request demonstrates how to apply an image to a PDF. Horizontal and vertical offsets of the image are measured in PDF units. (1 inch = 72 PDF units) */ var axios = require('axios'); var FormData = require('form-data'); diff --git a/JavaScript/Endpoint Examples/Multipart Payload/upload.js b/JavaScript/Endpoint Examples/Multipart Payload/upload.js index d9b6800..8400416 100644 --- a/JavaScript/Endpoint Examples/Multipart Payload/upload.js +++ b/JavaScript/Endpoint Examples/Multipart Payload/upload.js @@ -1,7 +1,7 @@ -// This request demonstrates how to upload . var axios = require('axios'); var FormData = require('form-data'); var fs = require('fs'); +// This request demonstrates how to upload a document to the service. // Create a new form data object and append the PDF file and parameters to it var data = new FormData(); diff --git a/PHP/Endpoint Examples/Multipart Payload/flattened-forms-pdf.php b/PHP/Endpoint Examples/Multipart Payload/flattened-forms-pdf.php index eb8b5c1..ab1f243 100644 --- a/PHP/Endpoint Examples/Multipart Payload/flattened-forms-pdf.php +++ b/PHP/Endpoint Examples/Multipart Payload/flattened-forms-pdf.php @@ -21,7 +21,7 @@ ], [ 'name' => 'output', - 'contents' => '' // Specify the output type (e.g., 'pdfrest_flattened_form', 'pdfrest_flattened_annotations', etc.) + 'contents' => 'pdfrest_flattened_pdf' // Specify the output name for the file ] ]]; diff --git a/PHP/Endpoint Examples/Multipart Payload/flattened-layers-pdf.php b/PHP/Endpoint Examples/Multipart Payload/flattened-layers-pdf.php index a585126..1986756 100644 --- a/PHP/Endpoint Examples/Multipart Payload/flattened-layers-pdf.php +++ b/PHP/Endpoint Examples/Multipart Payload/flattened-layers-pdf.php @@ -8,60 +8,28 @@ $client = new Client(); // Create a new instance of the Guzzle HTTP client. $headers = [ - 'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' // Set the API key in the headers for authentication. + 'Api-Key' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' // Set the API key in the headers for authentication. ]; $options = [ - 'multipart' => [ - [ - 'name' => 'file', - 'contents' => Utils::tryFopen('/path/to/file', 'r'), // Provide the path to the PDF file to be watermarked. - 'filename' => '/path/to/file', - 'headers' => [ - 'Content-Type' => '' // Specify the Content-Type header for the PDF file. - ] - ], - [ - 'name' => 'watermark_text', - 'contents' => 'Hello, watermarked world!' // Specify the text to be used as the watermark. - ], - [ - 'name' => 'font', - 'contents' => 'Arial' // Specify the font to be used for the watermark text. - ], - [ - 'name' => 'text_size', - 'contents' => '72' // Specify the font size of the watermark text. - ], - [ - 'name' => 'text_color_rgb', - 'contents' => '255,0,0' // Specify the RGB color (red, green, blue) of the watermark text. - ], - [ - 'name' => 'opacity', - 'contents' => '0.5' // Specify the opacity of the watermark (0.0 to 1.0). - ], - [ - 'name' => 'x', - 'contents' => '0' // Specify the x-coordinate of the watermark's position. - ], - [ - 'name' => 'y', - 'contents' => '0' // Specify the y-coordinate of the watermark's position. - ], - [ - 'name' => 'rotation', - 'contents' => '0' // Specify the rotation angle of the watermark (in degrees). - ], - [ - 'name' => 'output', - 'contents' => 'pdfrest_watermarked_pdf' // Specify the desired output format for the watermarked PDF. - ] + 'multipart' => [ + [ + 'name' => 'file', // Specify the field name for the file. + 'contents' => Utils::tryFopen('/path/to/file', 'r'), // Open the file specified by the '/path/to/file' for reading. + 'filename' => '/path/to/file', // Set the filename for the file to be processed, in this case, '/path/to/file'. + 'headers' => [ + 'Content-Type' => '' // Set the Content-Type header for the file. + ] + ], + [ + 'name' => 'output', // Specify the field name for the output option. + 'contents' => 'pdfrest_flattened_pdf' // Set the value for the output option (in this case, 'pdfrest_flattened_pdf'). ] + ] ]; -$request = new Request('POST', 'https://api.pdfrest.com/watermarked-pdf', $headers); // Create a new HTTP POST request with the API endpoint and headers. +$request = new Request('POST', 'https://api.pdfrest.com/flattened-layers-pdf', $headers); // Create a new HTTP POST request with the API endpoint and headers. $res = $client->sendAsync($request, $options)->wait(); // Send the asynchronous request and wait for the response. -echo $res->getBody(); // Output the response body, which contains the watermarked PDF. \ No newline at end of file +echo $res->getBody(); // Output the response body, which contains the flattened layers PDF content. diff --git a/PHP/Endpoint Examples/Multipart Payload/watermarked-pdf.php b/PHP/Endpoint Examples/Multipart Payload/watermarked-pdf.php index 1986756..8b3a5ca 100644 --- a/PHP/Endpoint Examples/Multipart Payload/watermarked-pdf.php +++ b/PHP/Endpoint Examples/Multipart Payload/watermarked-pdf.php @@ -21,15 +21,19 @@ 'Content-Type' => '' // Set the Content-Type header for the file. ] ], + [ + 'name' => 'watermark_text', // Specify the field name for the output option. + 'contents' => 'TEXT' // Set the value for the watermark_text option (in this case, 'TEXT'). + ] [ 'name' => 'output', // Specify the field name for the output option. - 'contents' => 'pdfrest_flattened_pdf' // Set the value for the output option (in this case, 'pdfrest_flattened_pdf'). + 'contents' => 'pdfrest_watermarked_pdf' // Set the value for the output option (in this case, 'pdfrest_watermarked_pdf'). ] ] ]; -$request = new Request('POST', 'https://api.pdfrest.com/flattened-layers-pdf', $headers); // Create a new HTTP POST request with the API endpoint and headers. +$request = new Request('POST', 'https://api.pdfrest.com/watermarked-pdf', $headers); // Create a new HTTP POST request with the API endpoint and headers. $res = $client->sendAsync($request, $options)->wait(); // Send the asynchronous request and wait for the response. -echo $res->getBody(); // Output the response body, which contains the flattened layers PDF content. +echo $res->getBody(); // Output the response body, which contains the watermarked PDF content. diff --git a/Python/Endpoint Examples/Multipart Payload/exported-form-data.py b/Python/Endpoint Examples/Multipart Payload/exported-form-data.py index ffed996..1106620 100644 --- a/Python/Endpoint Examples/Multipart Payload/exported-form-data.py +++ b/Python/Endpoint Examples/Multipart Payload/exported-form-data.py @@ -14,7 +14,7 @@ } ) -# Let's set the headers that the encrypted-pdf endpoint expects. +# Let's set the headers that the exported-form-data endpoint expects. # Since MultipartEncoder is used, the 'Content-Type' header gets set to 'multipart/form-data' via the content_type attribute below. headers = { 'Accept': 'application/json',