Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional parameters to code samples #60

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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