Skip to content

Latest commit

 

History

History
122 lines (86 loc) · 4.91 KB

File metadata and controls

122 lines (86 loc) · 4.91 KB

Swagger\Client\ConvertTemplateApi

All URIs are relative to https://api.cloudmersive.com

Method HTTP request Description
convertTemplateApplyDocxTemplate POST /convert/template/docx/apply Apply Word DOCX template
convertTemplateApplyHtmlTemplate POST /convert/template/html/apply Apply HTML template

convertTemplateApplyDocxTemplate

string convertTemplateApplyDocxTemplate($input_file, $template_definition)

Apply Word DOCX template

Apply operations to fill in a Word DOCX template by replacing target template/placeholder strings in the DOCX with values, generating a final Word DOCX result. For example, you could create a Word Document invoice containing strings such as "{FirstName}" and "{LastName}" and then replace these values with "John" and "Smith".

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Apikey', 'Bearer');

$apiInstance = new Swagger\Client\Api\ConvertTemplateApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$input_file = "/path/to/file.txt"; // \SplFileObject | Input file to perform the operation on.
$template_definition = "template_definition_example"; // string | Template definition for the document, including what values to replace

try {
    $result = $apiInstance->convertTemplateApplyDocxTemplate($input_file, $template_definition);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ConvertTemplateApi->convertTemplateApplyDocxTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
input_file \SplFileObject Input file to perform the operation on.
template_definition string Template definition for the document, including what values to replace [optional]

Return type

string

Authorization

Apikey

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/octet-stream

[Back to top] [Back to API list] [Back to Model list] [Back to README]

convertTemplateApplyHtmlTemplate

\Swagger\Client\Model\HtmlTemplateApplicationResponse convertTemplateApplyHtmlTemplate($value)

Apply HTML template

Apply operations to fill in an HTML template, generating a final HTML result

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: Apikey
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('Apikey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Apikey', 'Bearer');

$apiInstance = new Swagger\Client\Api\ConvertTemplateApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$value = new \Swagger\Client\Model\HtmlTemplateApplicationRequest(); // \Swagger\Client\Model\HtmlTemplateApplicationRequest | Operations to apply to template

try {
    $result = $apiInstance->convertTemplateApplyHtmlTemplate($value);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ConvertTemplateApi->convertTemplateApplyHtmlTemplate: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
value \Swagger\Client\Model\HtmlTemplateApplicationRequest Operations to apply to template

Return type

\Swagger\Client\Model\HtmlTemplateApplicationResponse

Authorization

Apikey

HTTP request headers

  • Content-Type: application/json, text/json, application/xml, text/xml, application/x-www-form-urlencoded
  • Accept: application/json, text/json, application/xml, text/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]