Table of Contents

Method ApplyAsync

Namespace
LMKit.Document.Pdf
Assembly
LM-Kit.NET.dll

ApplyAsync(Attachment, Watermark, PdfWatermarkOptions, CancellationToken)

Lays watermark over the pages of the PDF in source.

public static Task<PdfWatermarkResult> ApplyAsync(Attachment source, Watermark watermark, PdfWatermarkOptions options = null, CancellationToken cancellationToken = default)

Parameters

source Attachment

The PDF document.

watermark Watermark

What to draw and where.

options PdfWatermarkOptions

Which pages, replacement, signature consent and password; defaults when null.

cancellationToken CancellationToken

Cancels the operation between pages.

Returns

Task<PdfWatermarkResult>

The marked document and how many pages carry the mark.

Exceptions

ArgumentNullException

source or watermark is null.

ArgumentException

The watermark has neither text nor logo, its text is too long, or its font is not a font.

ArgumentOutOfRangeException

A page index is outside the document.

NotSupportedException

The document declares PDF/A-1.

WatermarkCharactersException

The text holds characters no available font can draw.

PdfSignatureInvalidationException

The document is signed and the options do not consent to invalidating it.

PdfDocumentException

The source is not a readable PDF, the password is wrong, or a page could not be written.

Share