Restpack 1.0.0
Restpack.io C# client for HTML to PDF API, and Screenshot API
See the version list below for details.
Install-Package Restpack -Version 1.0.0
dotnet add package Restpack --version 1.0.0
<PackageReference Include="Restpack" Version="1.0.0" />
paket add Restpack --version 1.0.0
#r "nuget: Restpack, 1.0.0"
restpack-csharp
Official C# client for Restpack APIs
Installation
The recommended way to install restpack-csharp is through Nuget:
Install the latest restpack-csharp nuget module:
$ dotnet add package Restpack
Finally, you need to require the library in your C# application:
Using Restpack;
Screenshot API
For detailed documentation, please visit Screenshot API v5 Reference page.
using System;
using Restpack.Screenshot;
namespace Program
{
class Program
{
static void Main(string[] args)
{
var Screenshot = new Screenshot("<YOUR ACCESS TOKEN>");
var options = new Screenshot.RequestOptions();
options.format = "png";
options.delay = 3000;
// Capture given URL. Return the document details and CDN url of the Image
var captureResult = Screenshot.Capture("https://google.com", options);
Console.writeLn(captureResult.Image);
// Capture given URL. Return the image file as bytes[]
var captureBytesResult = Screenshot.CaptureBytes("https://google.com", options);
Console.writeLn(captureBytesResult);
// Capture given html content. Return the document details and CDN url of the Image
var captureHTMLResult = Screenshot.CaptureHTML("<h1>Test</h1>", options);
Console.writeLn(captureHTMLResult.Image);
// Capture given html content. Return the image file as bytes[]
var captureBytesResult = Screenshot.CaptureHTMLBytes("<h1>Test</h1>", options);
Console.writeLn(captureBytesResult);
}
}
}
HTML To PDF API
For detailed documentation, please visit HTML to PDF API v5 Reference page.
using System;
using Restpack.Pdf2Html;
namespace Program
{
class Program
{
static void Main(string[] args)
{
var Pdf2Html = new Pdf2Html("<YOUR ACCESS TOKEN>");
var options = new Pdf2Html.RequestOptions();
options.format = "png";
options.delay = 3000;
// Convert given URL to PDF. Return the document details and CDN url of PDF
var captureResult = Pdf2Html.Convert("https://google.com", options);
Console.writeLn(captureResult.Image);
// Convert given URL to PDF. Return the PDF document as Buffer
var captureBytesResult = Pdf2Html.ConvertBytes("https://google.com", options);
Console.writeLn(captureBytesResult);
// Convert given html content to PDF. Return the document details and CDN url of PDF
var captureHTMLResult = Pdf2Html.ConvertHTML("<h1>Test</h1>", options);
Console.writeLn(captureHTMLResult.Image);
// Convert given html content to PDF. Return the PDF document as Buffer
var captureBytesResult = Pdf2Html.ConvertHTMLBytes("<h1>Test</h1>", options);
Console.writeLn(captureBytesResult);
}
}
}
restpack-csharp
Official C# client for Restpack APIs
Installation
The recommended way to install restpack-csharp is through Nuget:
Install the latest restpack-csharp nuget module:
$ dotnet add package Restpack
Finally, you need to require the library in your C# application:
Using Restpack;
Screenshot API
For detailed documentation, please visit Screenshot API v5 Reference page.
using System;
using Restpack.Screenshot;
namespace Program
{
class Program
{
static void Main(string[] args)
{
var Screenshot = new Screenshot("<YOUR ACCESS TOKEN>");
var options = new Screenshot.RequestOptions();
options.format = "png";
options.delay = 3000;
// Capture given URL. Return the document details and CDN url of the Image
var captureResult = Screenshot.Capture("https://google.com", options);
Console.writeLn(captureResult.Image);
// Capture given URL. Return the image file as bytes[]
var captureBytesResult = Screenshot.CaptureBytes("https://google.com", options);
Console.writeLn(captureBytesResult);
// Capture given html content. Return the document details and CDN url of the Image
var captureHTMLResult = Screenshot.CaptureHTML("<h1>Test</h1>", options);
Console.writeLn(captureHTMLResult.Image);
// Capture given html content. Return the image file as bytes[]
var captureBytesResult = Screenshot.CaptureHTMLBytes("<h1>Test</h1>", options);
Console.writeLn(captureBytesResult);
}
}
}
HTML To PDF API
For detailed documentation, please visit HTML to PDF API v5 Reference page.
using System;
using Restpack.Pdf2Html;
namespace Program
{
class Program
{
static void Main(string[] args)
{
var Pdf2Html = new Pdf2Html("<YOUR ACCESS TOKEN>");
var options = new Pdf2Html.RequestOptions();
options.format = "png";
options.delay = 3000;
// Convert given URL to PDF. Return the document details and CDN url of PDF
var captureResult = Pdf2Html.Convert("https://google.com", options);
Console.writeLn(captureResult.Image);
// Convert given URL to PDF. Return the PDF document as Buffer
var captureBytesResult = Pdf2Html.ConvertBytes("https://google.com", options);
Console.writeLn(captureBytesResult);
// Convert given html content to PDF. Return the document details and CDN url of PDF
var captureHTMLResult = Pdf2Html.ConvertHTML("<h1>Test</h1>", options);
Console.writeLn(captureHTMLResult.Image);
// Convert given html content to PDF. Return the PDF document as Buffer
var captureBytesResult = Pdf2Html.ConvertHTMLBytes("<h1>Test</h1>", options);
Console.writeLn(captureBytesResult);
}
}
}
Dependencies
-
- Newtonsoft.Json (>= 9.0.0)
- RestSharp (>= 106.6.9)
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.