The .NET SDK provides a client for integrating PDFGate API endpoints into your C# applications.
Source code: github.com/pdfgate/pdfgate-sdk-dotnet
Package: nuget.org/packages/PdfGate.net
Install the package with the .NET CLI, the NuGet CLI, or the Package Manager Console, then initialize the client with your API key.
1dotnet add package PdfGate.net1nuget install PdfGate.net1Install-Package PdfGate.netThe only requirement to create the client is your API key. Once initialized, the client is ready to call any of the available methods.
1using System.Text.Json;2using PdfGate.@net;3using [email protected];45internal static class Program6{7 private static void Main()8 {9 var apiKey = "test_your_api_key_here";1011 using var client = new PdfGate(apiKey);1213 // client is ready to call API methods, e.g. client.GeneratePdf(...)14 }15}A common workflow is to generate a PDF first, then download the resulting file stream using the returned document id.
1var request = new GeneratePdfRequest2{3 Html =4 "<html><body><h1>Hello from PDFGate</h1><p>Generated by SDK.</p></body></html>"5};67var generatedDoc = await client.GeneratePdfAsync(request, CancellationToken.None);89var getFileRequest = new GetFileRequest { DocumentId = generatedDoc.Id };1011Stream fileResponse = await client.GetFileAsync(getFileRequest, CancellationToken.None);| Method | Purpose |
|---|---|
GeneratePdfAsync | Generate a PDF from HTML or a URL. |
GetDocumentAsync | Retrieve document metadata and refreshed pre-signed URLs. |
GetFileAsync | Download the stored PDF stream for a document id. |
UploadFileAsync | Upload a PDF file for later transformations. |
FlattenPdfAsync | Flatten fillable form fields into a non-editable PDF. |
WatermarkPdfAsync | Apply text or image watermarks to a document. |
ProtectPdfAsync | Encrypt a PDF and apply restrictions such as print or copy limits. |
CompressPdfAsync | Compress a PDF and return the resulting document record. |
ExtractPdfFormDataAsync | Read field values from a fillable PDF. |
Use the SDK together with the main API documentation for request parameters, endpoint behavior, and workflow guides such as webhooks and PDF form fields.