Skip to content

Latest commit

 

History

History
73 lines (52 loc) · 1.57 KB

README.md

File metadata and controls

73 lines (52 loc) · 1.57 KB

BlazingDocs C#, .NET client

High-performance document generation API. Generate documents and reports from СSV, JSON, XML with 99,9% uptime and 24/7 monitoring.

Installation

Run this line from Package Manager Console:

Install-Package BlazingDocs -Version 1.0.0

Integration basics

Setup

You can get your API Key at https://app.blazingdocs.com

var client = new BlazingClient("api-key");

Getting account info

AccountModel account = await _client.GetAccountAsync();

Getting merge templates list

List<TemplateModel> templates = await _client.GetTemplatesAsync();

Getting usage info

UsageModel usage = await _client.GetUsageAsync();

Executing merge

using (var source = File.OpenRead("PO-Template.docx"))
{
    using (var reader = new StreamReader("PO-Template.json", Encoding.UTF8))
    {
        var data = reader.ReadToEnd();

        var parameters = new MergeParameters
        {
            Sequence = false, // data is object
            DataSourceType = DataSourceType.Json, // data in json format
            Strict = true // keep json types
        };

        var template = new FormFile("PO-Template.docx", source);

        var result = await _client.MergeAsync(data, "output.pdf", parameters, template);

        foreach (var file in result.Files)
        {
            using (var stream = new FileStream(file.Name, FileMode.Create))
            {
                file.SaveToAsync(stream).Wait();
            }
        }
    }
}

Documentation

See more details here https://docs.blazingdocs.com