{"id":31983188,"url":"https://github.com/simplify9/sw-pdftemplar-client","last_synced_at":"2026-01-20T17:56:04.076Z","repository":{"id":105927266,"uuid":"527952731","full_name":"simplify9/SW-PdfTemplar-Client","owner":"simplify9","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-16T12:45:10.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-18T20:48:04.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplify9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-23T11:08:45.000Z","updated_at":"2025-09-16T12:44:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"43102c93-5dde-498a-89f2-dadcc10c439e","html_url":"https://github.com/simplify9/SW-PdfTemplar-Client","commit_stats":null,"previous_names":["simplify9/sw-pdftemplar-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/simplify9/SW-PdfTemplar-Client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplify9%2FSW-PdfTemplar-Client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplify9%2FSW-PdfTemplar-Client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplify9%2FSW-PdfTemplar-Client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplify9%2FSW-PdfTemplar-Client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplify9","download_url":"https://codeload.github.com/simplify9/SW-PdfTemplar-Client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplify9%2FSW-PdfTemplar-Client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279043124,"owners_count":26091384,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-15T03:30:45.151Z","updated_at":"2025-10-15T03:31:30.040Z","avatar_url":"https://github.com/simplify9.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PdfTemplar Client SDK\n\n[![Build and Publish NuGet Package](https://github.com/simplify9/SW-PdfTemplar-Client/actions/workflows/nuget-publish.yml/badge.svg)](https://github.com/simplify9/SW-PdfTemplar-Client/actions/workflows/nuget-publish.yml)\n[![NuGet](https://img.shields.io/nuget/v/SimplyWorks.PdfTemplarClient.svg)](https://www.nuget.org/packages/SimplyWorks.PdfTemplarClient/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA .NET client SDK for PdfTemplar - a service that generates PDF documents from templates and data objects.\n\n## Features\n\n- Generate PDF documents by sending templates and data objects to PdfTemplar service\n- Configurable JSON naming strategies (SnakeCase, CamelCase, CapitalCase)\n- Comprehensive error handling with specific error codes\n- Built-in HTTP client integration with `IHttpClientFactory`\n- .NET 8.0 target framework\n\n## Installation\n\nInstall via NuGet Package Manager:\n\n```bash\ndotnet add package SimplyWorks.PdfTemplarClient\n```\n\nOr via Package Manager Console:\n\n```\nInstall-Package SimplyWorks.PdfTemplarClient\n```\n\n## Usage\n\n### Basic Setup\n\n```csharp\nusing Microsoft.Extensions.DependencyInjection;\nusing SW.PdfTemplar.Client;\n\n// Configure services\nservices.AddHttpClient();\n\n// Configure PdfTemplar settings\nvar settings = new PdfTemplarClientSettings\n{\n    ServiceUri = \"https://pdftemplar.sf9.io/\", // Default service URI\n    NamingStrategy = NamingStrategy.CamelCase   // JSON naming strategy\n};\n\n// Create client instance\nvar pdfTemplar = new PdfTemplar(settings, httpClientFactory);\n```\n\n### Generate PDF Document\n\n```csharp\n// Define your data model\nvar model = new\n{\n    CustomerName = \"John Doe\",\n    OrderDate = DateTime.Now,\n    Items = new[]\n    {\n        new { Product = \"Widget A\", Quantity = 2, Price = 10.00 },\n        new { Product = \"Widget B\", Quantity = 1, Price = 15.00 }\n    }\n};\n\ntry\n{\n    // Generate PDF document\n    FileData pdfFile = await pdfTemplar.GetDocument(\"invoice-template\", model);\n    \n    // Use the generated PDF\n    string fileName = pdfFile.FileName;        // \"generatedPDF.pdf\"\n    string mimeType = pdfFile.MimeType;        // \"application/pdf\"\n    byte[] pdfContent = pdfFile.InlineData;    // PDF file bytes\n}\ncatch (PdfTemplarException ex)\n{\n    // Handle specific PDF generation errors\n    switch (ex.Error)\n    {\n        case PdfTemplarError.TemplateInvalid:\n            // Handle invalid template\n            break;\n        case PdfTemplarError.ServerError:\n            // Handle server error\n            break;\n        case PdfTemplarError.Timeout:\n            // Handle timeout\n            break;\n        case PdfTemplarError.GatewayError:\n            // Handle gateway error\n            break;\n    }\n}\n```\n\n## Configuration\n\n### PdfTemplarClientSettings\n\n| Property | Type | Default | Description |\n|----------|------|---------|-------------|\n| `ServiceUri` | `string` | `\"https://pdftemplar.sf9.io/\"` | The base URI of the PdfTemplar service |\n| `NamingStrategy` | `NamingStrategy` | `CapitalCase` | JSON serialization naming strategy |\n\n### Naming Strategies\n\n- **`CapitalCase`** - PascalCase property names (default)\n- **`CamelCase`** - camelCase property names  \n- **`SnakeCase`** - snake_case property names\n\n## Error Handling\n\nThe SDK provides specific error codes through `PdfTemplarException`:\n\n| Error Code | Description |\n|------------|-------------|\n| `TemplateInvalid` | The provided template is invalid or not found |\n| `ServerError` | Internal server error occurred |\n| `Timeout` | Request timed out |\n| `GatewayError` | Gateway error (service may be restarting) |\n\n## Models\n\n### FileData\nRepresents the generated PDF document:\n```csharp\npublic class FileData\n{\n    public string MimeType { get; set; }    // \"application/pdf\"\n    public byte[] InlineData { get; set; }  // PDF file content\n    public string FileName { get; set; }    // File name\n}\n```\n\n## Dependencies\n\n- **Microsoft.Extensions.Http** (8.0.1) - HTTP client factory\n- **Newtonsoft.Json** (13.0.4) - JSON serialization\n- **System.Configuration.ConfigurationManager** (8.0.1) - Configuration management\n- **System.Text.Encoding** (4.3.0) - Text encoding support\n\n## Requirements\n\n- .NET 8.0 or later\n- Access to PdfTemplar service\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nThis is an open source project by [Simplify9](https://github.com/simplify9). Contributions are welcome!\n\n## Support\n\nFor issues and questions, please use the [GitHub Issues](https://github.com/simplify9/SW-PdfTemplar-Client/issues) page.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplify9%2Fsw-pdftemplar-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplify9%2Fsw-pdftemplar-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplify9%2Fsw-pdftemplar-client/lists"}