Skip to content

Commit 1b03507

Browse files
committed
Update documentation
1 parent 0dad696 commit 1b03507

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This repository contains the C# source code for the .NET clients to the PDFinch
55

66
You need to have an account with enough credits and an active set of API keys. You can [register an account or log in here](https://www.pdfinch.com/account/login).
77
# Basic usage
8-
Our API currently supports one thing: generating PDFs from HTML. You can do so by calling `IPdfClient.GeneratePdfFromHtmlAsync()`:
8+
Our API currently supports one thing: generating PDFs from HTML, with some variations. The most simple way is available by calling `IPdfClient.GeneratePdfFromHtmlAsync()`:
99

1010
```C#
1111
IPdfClient pdfClient = ... // see chapter "Obtaining an IPdfClient" below
@@ -31,8 +31,29 @@ else
3131
throw new InvalidOperationException($"Error generating PDF: {pdfResult.StatusMessage}");
3232
}
3333
```
34+
35+
You can also merge multiple blocks of HTML:
36+
37+
```C#
38+
PdfResult<Stream> pdfResult = await pdfClient.GenerateMergedPdfFromHtmlAsync(new []
39+
{
40+
new PdfRequest("<h1>Your-Html-String</h1>")
41+
{
42+
MarginBottom = 10,
43+
MarginTop = 10,
44+
MarginLeft = 10,
45+
MarginRight = 10,
46+
Landscape = false,
47+
GrayScale = false,
48+
}, new PdfRequest("<h1>Your-Second-Html</h1>")
49+
{
50+
Landscape = true,
51+
},
52+
});
53+
```
54+
3455
# Handling responses
35-
`PDFinch.Client.Common.IPdfClient.GeneratePdfFromHtmlAsync()` returns a `Task<PdfResult<Stream>>`. This means the call should be `await`ed, and the return value must be checked for success.
56+
The `PDFinch.Client.Common.IPdfClient.Generate...Async()` methods return a `Task<PdfResult<Stream>>`. This means the call should be `await`ed, and the return value must be checked for success.
3657

3758
If `PdfResult<Stream>.Success` is `false`, `.Data` will be `null` and `.StatusMessage` will contain a machine-readable (JSON) error message returned by the API.
3859

0 commit comments

Comments
 (0)