Skip to content

Commit

Permalink
Merge pull request #60 from datalogics-tsmith/add-extra-options
Browse files Browse the repository at this point in the history
Add optional parameters to code samples
  • Loading branch information
datalogics-cgreen authored Dec 11, 2023
2 parents 1e3c61d + 9f32834 commit 47597be
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes("xml"));
multipartContent.Add(byteArrayOption, "data_format");

var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes("extracted"));
multipartContent.Add(byteArrayOption2, "output");


request.Content = multipartContent;
var response = await httpClient.SendAsync(request);
Expand Down
3 changes: 3 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/extracted-text.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
multipartContent.Add(byteAryContent, "file", "file_name");
byteAryContent.Headers.TryAddWithoutValidation("Content-Type", "application/pdf");

var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes("on"));
multipartContent.Add(byteArrayOption, "word_style");


request.Content = multipartContent;
var response = await httpClient.SendAsync(request);
Expand Down
3 changes: 3 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/merged-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
var byteArrayOption4 = new ByteArrayContent(Encoding.UTF8.GetBytes("all"));
multipartContent.Add(byteArrayOption4, "pages[]");

var byteArrayOption5 = new ByteArrayContent(Encoding.UTF8.GetBytes("merged"));
multipartContent.Add(byteArrayOption5, "output");

request.Content = multipartContent;
var response = await httpClient.SendAsync(request);

Expand Down
3 changes: 3 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/split-pdf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
var byteArrayOption2 = new ByteArrayContent(Encoding.UTF8.GetBytes("2-last"));
multipartContent.Add(byteArrayOption2, "pages[]");

var byteArrayOption3 = new ByteArrayContent(Encoding.UTF8.GetBytes("split"));
multipartContent.Add(byteArrayOption3, "output");


request.Content = multipartContent;
var response = await httpClient.SendAsync(request);
Expand Down
3 changes: 3 additions & 0 deletions DotNET/Endpoint Examples/Multipart Payload/word.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
multipartContent.Add(byteAryContent, "file", "file_name");
byteAryContent.Headers.TryAddWithoutValidation("Content-Type", "application/pdf");

var byteArrayOption = new ByteArrayContent(Encoding.UTF8.GetBytes("converted"));
multipartContent.Add(byteArrayOption, "output");


request.Content = multipartContent;
var response = await httpClient.SendAsync(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var fs = require("fs");
// Create a new form data instance and append the PDF file and parameters to it
var data = new FormData();
data.append("file", fs.createReadStream("/path/to/file"));
data.append("word_style", "on");

// define configuration options for axios request
var config = {
Expand Down
4 changes: 4 additions & 0 deletions PHP/Endpoint Examples/Multipart Payload/extracted-text.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
'headers' => [
'Content-Type' => '<Content-type header>' // Set the Content-Type header for the file.
]
],
[
'name' => 'word_style', // Specify the field name for the word_style option.
'contents' => 'on' // Set the value for the output option (in this case, 'on').
]
]
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
mp_encoder_extractText = MultipartEncoder(
fields={
'file': ('file_name.pdf', open('/path/to/file', 'rb'), 'application/pdf'),
'word_style': 'on',
}
)

Expand Down

0 comments on commit 47597be

Please sign in to comment.