Pdfless 1.0.2

dotnet add package Pdfless --version 1.0.2
NuGet\Install-Package Pdfless -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pdfless" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pdfless --version 1.0.2
#r "nuget: Pdfless, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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

Pdfless Logo

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 142 5/21/2023
1.0.1 126 5/21/2023
1.0.0 120 5/21/2023