Pdfless 1.0.2
dotnet add package Pdfless --version 1.0.2
NuGet\Install-Package Pdfless -Version 1.0.2
<PackageReference Include="Pdfless" Version="1.0.2" />
paket add Pdfless --version 1.0.2
#r "nuget: Pdfless, 1.0.2"
// Install Pdfless as a Cake Addin #addin nuget:?package=Pdfless&version=1.0.2 // Install Pdfless as a Cake Tool #tool nuget:?package=Pdfless&version=1.0.2
Introduction
The Official Pdfless C# to consume Pdfless API. https://www.pdfless.com/
This library supports .NET Standard 2.1+, netcore 3.1+
Prerequisites
Pdfless account is required, sign up for free for free to create up to 100 pdfs/month forever.
Installation
Using the [.NET Core command-line interface (CLI) tools][dotnet-core-cli-tools]:
dotnet add package Pdfless
Using the [NuGet Command Line Interface (CLI)][nuget-cli]:
nuget install Pdfless
Using the [Package Manager Console][package-manager-console]:
Install-Package Pdfless
From within Visual Studio:
Open the Solution Explorer. Right-click on a project within your solution. Click on Manage NuGet Packages... Click on the Browse tab and search for "Pdfless". Click on the Pdfless package, select the appropriate version in the right-tab and click Install.
Get started
Configuration Appsetting
In your config file, add this config block :
"Pdfless": {
"ApiKey": "ak_xxxxxxxxx"
}
Middleware
In your startup.cs, add Pdfless middleware.
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Pdfless.Extensions;
namespace YourApp.WebApi
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
services.AddPdfless(Configuration);
services.AddControllers();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}
WebProxy
You can configure WebProxy :
public void ConfigureServices(IServiceCollection services)
{
var proxy = new WebProxy("http://proxy:1337");
services.AddPdfless(Configuration, proxy);
services.AddControllers();
}
Usage
In your class, inject IPdflessClient through the constructor
private readonly IPdflessClient _pdflessClient;
public MyConstructor(IPdflessClient pdflessClient)
{
_pdflessClient = pdflessClient ?? throw new ArgumentNullException(nameof(pdflessClient));
}
Call CreateAsync
function to generate PDF
public async Task Myfunction()
{
var payload = new DocumentContent
{
Company = "Synapsium",
AddressCompany = "10 boulevard de la République, 75001 Paris"
};
var result = await _pdflessClient.CreateAsync("xxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxx", payload);
}
Methods
Task<Response<PdfResponse>> CreateAsync(string templateId, object payload);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection (>= 3.1.32)
- Microsoft.Extensions.Hosting.Abstractions (>= 3.1.32)
- Microsoft.Extensions.Http (>= 3.1.32)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 3.1.32)
- System.Text.Json (>= 4.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.