Class PdfDocumentTaskExtensions
- Namespace
- CobaltPdf
- Assembly
- CobaltPdf.dll
Extension methods that allow PdfDocument operations to be chained
directly off a Task<TResult> — i.e. off the render call itself —
without an intermediate await.
public static class PdfDocumentTaskExtensions
- Inheritance
-
PdfDocumentTaskExtensions
- Inherited Members
Examples
// SaveAs chained directly — no intermediate variable needed
await renderer
.WithLandscape()
.RenderUrlAsPdfAsync("https://example.com")
.SaveAs("output.pdf");
// Async variant
await renderer
.WithLandscape()
.RenderUrlAsPdfAsync("https://example.com")
.SaveAsAsync("output.pdf");
Methods
SaveAs(Task<PdfDocument>, string)
Awaits the render task, saves the resulting PDF to path, and
returns the PdfDocument for further chaining.
public static Task<PdfDocument> SaveAs(this Task<PdfDocument> task, string path)
Parameters
taskTask<PdfDocument>The in-flight render task.
pathstringThe file path to write the PDF to.
Returns
- Task<PdfDocument>
The resolved PdfDocument, allowing further chaining.
SaveAsAsync(Task<PdfDocument>, string)
Awaits the render task, asynchronously saves the resulting PDF to
path, and returns the PdfDocument for further chaining.
public static Task<PdfDocument> SaveAsAsync(this Task<PdfDocument> task, string path)
Parameters
taskTask<PdfDocument>The in-flight render task.
pathstringThe file path to write the PDF to.
Returns
- Task<PdfDocument>
A task resolving to the PdfDocument, allowing further chaining.