Table of Contents

Interface IPdfGenerator

Namespace
CobaltPdf.WebKit
Assembly
CobaltPDF.WebKit.dll

Fluent configuration + render contract for a single PDF generation operation.

public interface IPdfGenerator

Methods

AddCookie(string, string, string?, string)

IPdfGenerator AddCookie(string name, string value, string? domain = null, string path = "/")

Parameters

name string
value string
domain string
path string

Returns

IPdfGenerator

AddLocalStorage(string, string)

IPdfGenerator AddLocalStorage(string key, string value)

Parameters

key string
value string

Returns

IPdfGenerator

AddSessionStorage(string, string)

IPdfGenerator AddSessionStorage(string key, string value)

Parameters

key string
value string

Returns

IPdfGenerator

RenderHtmlAsPdfAsync(string, CancellationToken)

Task<PdfDocument> RenderHtmlAsPdfAsync(string html, CancellationToken cancellationToken = default)

Parameters

html string
cancellationToken CancellationToken

Returns

Task<PdfDocument>

RenderHtmlFileAsPdfAsync(string, CancellationToken)

Task<PdfDocument> RenderHtmlFileAsPdfAsync(string filePath, CancellationToken cancellationToken = default)

Parameters

filePath string
cancellationToken CancellationToken

Returns

Task<PdfDocument>

RenderUrlAsPdfAsync(string, CancellationToken)

Task<PdfDocument> RenderUrlAsPdfAsync(string url, CancellationToken cancellationToken = default)

Parameters

url string
cancellationToken CancellationToken

Returns

Task<PdfDocument>

WithCspBypass(bool)

IPdfGenerator WithCspBypass(bool enable = true)

Parameters

enable bool

Returns

IPdfGenerator

WithCustomJS(string)

IPdfGeneratorFinal WithCustomJS(string script)

Parameters

script string

Returns

IPdfGeneratorFinal

WithEncryption(PdfEncryptionOptions)

IPdfGenerator WithEncryption(PdfEncryptionOptions encryption)

Parameters

encryption PdfEncryptionOptions

Returns

IPdfGenerator

WithFonts(string)

IPdfGenerator WithFonts(string fontDirectoryPath)

Parameters

fontDirectoryPath string

Returns

IPdfGenerator

WithFooter(string)

IPdfGenerator WithFooter(string htmlOrFilePath)

Parameters

htmlOrFilePath string

Returns

IPdfGenerator

WithGrayscale()

IPdfGenerator WithGrayscale()

Returns

IPdfGenerator

WithHeader(string)

IPdfGenerator WithHeader(string htmlOrFilePath)

Parameters

htmlOrFilePath string

Returns

IPdfGenerator

WithHttpHeader(string, string)

IPdfGenerator WithHttpHeader(string name, string value)

Parameters

name string
value string

Returns

IPdfGenerator

WithHttpHeaders(IDictionary<string, string>)

IPdfGenerator WithHttpHeaders(IDictionary<string, string> headers)

Parameters

headers IDictionary<string, string>

Returns

IPdfGenerator

WithLandscape()

IPdfGenerator WithLandscape()

Returns

IPdfGenerator

WithLazyLoadPages(int, TimeSpan?, TimeSpan?)

IPdfGenerator WithLazyLoadPages(int pageCount, TimeSpan? delay = null, TimeSpan? timeout = null)

Parameters

pageCount int
delay TimeSpan?
timeout TimeSpan?

Returns

IPdfGenerator

WithMargins(MarginOptions)

IPdfGenerator WithMargins(MarginOptions margins)

Parameters

margins MarginOptions

Returns

IPdfGenerator

WithMediaType(CssMediaType)

IPdfGenerator WithMediaType(CssMediaType type)

Parameters

type CssMediaType

Returns

IPdfGenerator

WithMetadata(Action<MetadataOptions>)

IPdfGenerator WithMetadata(Action<MetadataOptions> configure)

Parameters

configure Action<MetadataOptions>

Returns

IPdfGenerator

WithPageRanges(string)

IPdfGenerator WithPageRanges(string ranges)

Parameters

ranges string

Returns

IPdfGenerator

WithPageSize(string, string)

IPdfGenerator WithPageSize(string width, string height)

Parameters

width string
height string

Returns

IPdfGenerator

WithPaperFormat(string)

IPdfGenerator WithPaperFormat(string format)

Parameters

format string

Returns

IPdfGenerator

WithPrintBackground(bool)

IPdfGenerator WithPrintBackground(bool enable = true)

Parameters

enable bool

Returns

IPdfGenerator

WithReloadAfterStorage()

IPdfGenerator WithReloadAfterStorage()

Returns

IPdfGenerator

WithScale(float)

IPdfGenerator WithScale(float scale)

Parameters

scale float

Returns

IPdfGenerator

WithUserAgent(string)

IPdfGenerator WithUserAgent(string userAgent)

Parameters

userAgent string

Returns

IPdfGenerator

WithWaitStrategy(WaitOptions)

IPdfGenerator WithWaitStrategy(WaitOptions strategy)

Parameters

strategy WaitOptions

Returns

IPdfGenerator

WithWatermark(WatermarkOptions)

IPdfGenerator WithWatermark(WatermarkOptions watermark)

Parameters

watermark WatermarkOptions

Returns

IPdfGenerator