Method ApplyAsync
ApplyAsync(Attachment, IReadOnlyList<PageEdit>, CancellationToken)
Applies a sequence of page edits to a PDF document and returns the result as an attachment.
public static Task<Attachment> ApplyAsync(Attachment source, IReadOnlyList<PageEdit> edits, CancellationToken cancellationToken = default)
Parameters
sourceAttachmentThe source PDF attachment.
editsIReadOnlyList<PageEdit>Ordered list of page edits. Each edit specifies a zero-based source page index and the rotation to apply.
cancellationTokenCancellationTokenCancels the operation.
Returns
- Task<Attachment>
A new Attachment containing the edited PDF.
Examples
using LMKit.Data;
using LMKit.Document.Pdf;
var src = new Attachment("contract.pdf");
var edits = new[]
{
new PageEdit(2, PageOrientations.Normal), // keep page 3 as-is
new PageEdit(0, PageOrientations.Rotated90CW), // page 1 rotated 90 CW
};
Attachment edited = PdfEditor.Apply(src, edits);