C++ SDK as a wrapper for the GroupDocs.Assembly Cloud API. Create highly‑customized reports, contracts, invoices and more directly from your C++ applications.
Start Free TrialGroupDocs.Assembly Cloud SDK for C++ provides a high‑level, cross‑platform wrapper around the Assembly Cloud REST API, allowing developers to generate richly formatted documents directly from their C++ applications. The solution is built around templates—documents that contain special placeholder fields and generation rules—combined with data sources (XML or JSON). By sending the template and data to the cloud, the service assembles the final output in the desired format (DOCX, PDF, HTML, etc.) and returns it instantly.
Why use Assembly Cloud?
Typical workflow in C++
InvoiceTemplate.docx
) to GroupDocs Cloud Storage using the UploadFile
endpoint.invoice.json
or invoice.xml
), and the desired output format.This approach enables the creation of complex, multi‑page reports, personalized letters (Mail Merge), invoices, contracts, and any document that combines static content with dynamic data. Because the SDK is lightweight and works on any OS that supports C++11 and cURL, you can integrate it into desktop applications, server‑side services, or containerized micro‑services with minimal effort.
The example below demonstrates the typical workflow: configure the SDK, upload a template, set assembly options, and call the Assemble endpoint to receive the generated document.
Steps:
Input1.docx
) to GroupDocs Cloud Storage.TemplateFileInfo
pointing to the uploaded template.docx
) and provide the data source (Input2.json
).assembleDocument
to generate the final document.using namespace groupdocs::assembly;
using namespace groupdocs::assembly::cloud::api;
// 1. Configure SDK with your credentials
auto config = std::make_shared<Configuration>(L"####################", L"####################");
auto assemblyApi = std::make_shared<AssemblyApi>(config);
// 2. Upload template file
auto fileName = L"Input1.docx";
auto requestFileContent = std::shared_ptr<std::istream>(
new std::ifstream(std::filesystem::path(fileName), std::istream::binary));
std::shared_ptr<UploadFileRequest> uploadDocumentRequest(
new UploadFileRequest(requestFileContent, std::make_shared<std::wstring>(fileName)));
assemblyApi->uploadFile(uploadDocumentRequest);
// 3. Prepare assembly options
auto fileInfo = std::make_shared<TemplateFileInfo>();
fileInfo->setFilePath(fileName);
auto assembleOptions = std::make_shared<AssembleOptions>();
assembleOptions->setSaveFormat("docx");
assembleOptions->setReportData(std::filesystem::path(L"Input2.json")); // data source
assembleOptions->setTemplateFileInfo(fileInfo);
// 4. Assemble document
auto request = std::make_shared<AssembleDocumentRequest>(assembleOptions);
assemblyApi->assembleDocument(request);