Back to Devexpress

PdfPageFacade.FlattenAnnotations(Func<PdfAnnotationFacade, Boolean>) Method

officefileapi-devexpress-dot-pdf-dot-pdfpagefacade-dot-flattenannotations-x28-system-dot-func-devexpress-dot-pdf-dot-pdfannotationfacade-system-dot-boolean-x29.md

latest2.6 KB
Original Source

PdfPageFacade.FlattenAnnotations(Func<PdfAnnotationFacade, Boolean>) Method

Flattens all page annotations that meet the specified criteria.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public void FlattenAnnotations(
    Func<PdfAnnotationFacade, bool> predicate
)
vb
Public Sub FlattenAnnotations(
    predicate As Func(Of PdfAnnotationFacade, Boolean)
)

Parameters

NameTypeDescription
predicateFunc<PdfAnnotationFacade, Boolean>

Defines a set of criteria for the PdfAnnotationFacade object.

|

Example

The code sample below flattens all annotations that are located on the lower half of the first page:

csharp
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
  // Load a document
  processor.LoadDocument("..\\..\\Document.pdf");
  PdfPageFacade pageFacade = processor.DocumentFacade.Pages[0];

  // Flatten annotations located
  // on the lower half of the first page
  double halfPage = processor.Document.Pages[0].CropBox.Top / 2;
  pageFacade.FlattenAnnotations(x => x.Rectangle.Top < halfPage);

  // Save the result
  processor.SaveDocument("..\\..\\Result.pdf");
}
vb
Using processor As New PdfDocumentProcessor()
  ' Load a document
  processor.LoadDocument("..\..\Document.pdf")
  Dim pageFacade As PdfPageFacade = processor.DocumentFacade.Pages(0)

  ' Flatten annotations located
  ' on the lower half of the first page
  Dim halfPage As Double = processor.Document.Pages(0).CropBox.Top / 2
  pageFacade.FlattenAnnotations(Function(x) x.Rectangle.Top < halfPage)

  ' Save the result
  processor.SaveDocument("..\..\Result.pdf")
End Using

See Also

PdfPageFacade Class

PdfPageFacade Members

DevExpress.Pdf Namespace